formula Newbie
Joined: 10 Jan 2005 Posts: 3
|
Posted: Jan 19th, 2005 06:44 AM Post subject: Problem to open record set |
|
|
Hi
I try to import data from excel and insert them into mysql db.
I have this code:
| Code: | '
## Create Connection and Recordsets
Dim Conn, RS
Set Conn = CreateObject("ADODB.Connection")
Set RS = CreateObject("ADODB.Recordset")
set conn1=server.createobject ("adodb.connection")
conn1.open"dsn=amsterdam"
'set rec=server.createobject ("adodb.recordset")
'rec.activeconnection=conn1
'## The Excel File Name
XLFile = "c:/php/uploadtemp/vsi.xls"
'## The Data to extract
szSQL = "select * from Events"
'## Create and open the connection
Conn.ConnectionString = "DBQ=" & XLFile & ";DRIVER=Microsoft Excel Driver (*.xls);UID=admin;"
Conn.Open
'## set the cursor to be static.
rs.cursortype = 3 ' adStatic.
'## open the recordset
rs.open szSQL, conn
'## iterate through the recordset.
''response.write ""
while not rs.eof
msg=""
Programme = RS("Programme")
Episode = RS("Episode:")
Air_date = RS("Air date")
Sql = "insert into tbl_jobs (job_name,status) values ('"&Programme&"',1)"
conn1.execute Sql
Sql = "select * from tbl_jobs order by job_id desc limit 1"
rec.open Sql,conn1
job_id = rec.fields("job_id")
Sql = "insert into tbl_data (job_id,client_id,col_id,data,status_id) values ('"&job_id&"','1','35','','')"
conn1.execute Sql
rs.movenext
wend
RS.close
Set RS=nothing
|
I get this error: Microsoft VBScript runtime error '800a01a8'
Object required: ''
Why?
Thanks
formula |
|