Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 user upload / bulk add

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
chumbawumba Posted - 15 May 2007 : 00:54:07
Hello

does anybody have code to bulk add users from a .csv file into snitz. I need the code to be able to open the text file and then insert the users into the DB

thanks <
6   L A T E S T    R E P L I E S    (Newest First)
chumbawumba Posted - 23 May 2007 : 00:53:53
OK, here is the code to be used as a starting point:


<%
  'CONNECT TO THE DATABASE
  set objconn = Server.CreateObject("ADODB.Connection")
  objconn.Provider="Microsoft.Jet.OLEDB.4.0"
  objconn.Open Server.MapPath("csv.mdb")


  csv_to_read="test.csv"
  set fso = createobject("scripting.filesystemobject")
  set act = fso.opentextfile(server.mappath(csv_to_read),1,False)

  dim sline
  dim sSeg
  
  Do Until act.AtEndOfStream
  
  sline=act.readline
  sSeg=split(sline,",")

  dim strsql
  strsql="INSERT INTO CSV (Sequence, Text, Name, Grade)"
  strsql=strsql & "VALUES('"&sSeg(0)&"', '"&sSeg(1)&"',
  '"&sSeg(2)"', '"&sSeg(3)&"')"

  objconn.execute strsql
     
  loop
  act.close
  set act=nothing
   
  'CLOSE THE CONNECTION AND CLEAN UP
  objconn.close
  set objconn=nothing
%>


<
kolucoms6 Posted - 20 May 2007 : 17:08:36
Right.<
muzishun Posted - 20 May 2007 : 11:14:51
Would you mind posting the code (and possibly the format your csv file is in) for others who may need it in the future?<
chumbawumba Posted - 20 May 2007 : 07:31:01
I have found some working code from wrox.com

The HR department have outputted a list of employees from one DB that need uploading into a different DB. The systems aren't linked. A convenient way to enter the users was through reading a csv file. Anyway thanks problem solved.<
HuwR Posted - 18 May 2007 : 05:00:35
doesn't look like, it. in general you would copy user records from one db to another, why do you have them in a csv file ?

depending on the database you are using, there is usually functionality in the database tools to import data from a csv file<
chumbawumba Posted - 17 May 2007 : 21:46:46
does anyone have any similar code that I can use as a starting point?
TIA<

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07