Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch problem in importing w/ VB Script

Status
Not open for further replies.

baybook

MIS
Sep 16, 2004
66
0
0
US
I am trying to importa a file into a mysql database. The file is a comma delimited text file. I'm having some trouble with the VBScript at this pont... I get a type mismatch at this line.
datcols=split(dat,",")


Here is the rest of the code. Does anyone see the problem?

while not objTS.AtEndOfStream
dat = objTS.ReadLine
datcols=split(dat,",")
mySQL ="UPDATE order SET auth = datcols(1) where order_id = datcols(0)"
conn.Execute mySQL
wend


Thanks!
 
Are dat and datcols used elsewhere ? (even a Dim instruction)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OOps, I suspect an error here:
mySQL ="UPDATE order SET auth = datcols(1) where order_id = datcols(0)"
I'd try:
mySQL ="UPDATE order SET auth='" & datcols(1) & "' WHERE order_id='" & datcols(0) & "'"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
they were declared earlier

dim FSO, TS, i , dat
dim datcols(2)

I made those chnages to the SQL but the problem is somewhere on this line
datcols=split(dat,",")

I continue to get the same error.

 
For anyone with this problem, works fine when I did not dim the array in advance
 
Replace this:
dim datcols(2)
By this:
dim datcols

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top