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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Rdo to connect to an Sql db 1

Status
Not open for further replies.

nhidalgo

MIS
Jun 13, 2001
619
US
I am using the following code to connect to and insert data into a sql db. I get an error stating that the SQL statment coudn't be prepared. I have new used Rdo and Sql, ususally just use acess. Any help or links would be great.
Thanks
Nick


Dim en As rdoEnvironment
Dim cn As New rdoConnection
Set en = rdoEnvironments(0)
Conn = "DSN=SMHost;UID=sa;PWD=;DATABASE=SMHost;"
Set cn = en.OpenConnection("", rdDriverNoPrompt, False, Conn)
cn.QueryTimeout = 0


sSQL = "insert nh_inventory(DB_KEY,DB_STORENUM,DB_RECEIVERNUM,) " & _
"values(" & storenum & "," & storenum & "," & receivernum & ")"
cn.Execute (sSQL)
 
Modify the SQL Statement to:

sSQL = "insert into nh_inventory(DB_KEY,DB_STORENUM,DB_RECEIVERNUM) " & _
"values(" & storenum & "," & storenum & "," & receivernum & ")"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top