Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Other Languages

Post new topic   Reply to topic
Problem to open record set
View previous topic :: View next topic  
Author Message
formula
Newbie


Joined: 10 Jan 2005
Posts: 3

PostPosted: Jan 19th, 2005 06:44 AM    Post subject: Problem to open record set Reply with quote

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
Back to top
View user's profile Send private message
more
Newbie


Joined: 07 Jun 2005
Posts: 13

PostPosted: Jun 7th, 2005 04:53 AM    Post subject: Reply with quote

Try the references in the edit environment.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Other Languages All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic