The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
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
<
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
نوشته شده در
does anyone have any similar code that I can use as a starting point?
TIA<
Can't stop, lose job, mind gone, silicon.
نوشته شده در
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<
depending on the database you are using, there is usually functionality in the database tools to import data from a csv file<
نوشته شده در
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.<
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.<
نوشته شده در
Would you mind posting the code (and possibly the format your csv file is in) for others who may need it in the future?<
Bill Parrott
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
Senior Web Programmer, University of Kansas
Co-Owner and Code Monkey, Eternal Second Designs (www.eternalsecond.com)
Personal Website (www.chimericdream.com)
نوشته شده در
Right.<
نوشته شده در
OK, here is the code to be used as a starting point:
<
Code:
<%
'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
%>
<
Email Member
Message Member
Post Moderation
بارگزاری فایل
If you're having problems uploading, try choosing a smaller image.
پیشنمایش مطلب
Send Topic
Loading...