|
-
Jan 26th, 2009, 12:41 PM
#1
Thread Starter
Junior Member
Help with insert query using VB6
I can't get the following insert statement to work using VB6. As you can see from the code, I am trying to insert dummy text data into the "Data_Cert_Results" table. Any ideas....?
My error upon calling Execute is:
Unable to execute -
(-2147217900: The name "aaaaaaa" is not permitted in this contect. Valid expressions are constants, contant, expressions, and (in some contects) variables. Column names are not permitted.
Dim mobjADOConn As adodb.Connection
Dim dbrs As adodb.Recordset
Dim sqlstrInsert As String
Dim td As String
Dim ca As String
Dim pc As String
Set mobjADOConn = New adodb.Connection
mobjADOConn.ConnectionString = "DSN=aaa;Uid=bbb;Pwd=ccc;"
mobjADOConn.Open
' Create a Recordsets by executing an SQL statement.
Set dbrs = mobjADOConn.Execute(sqlstr)
' Loop through the recordset and show the fields.
If dbrs.RecordCount >= 1 Then
dbrs.MoveFirst
End If
Do While Not dbrs.EOF
' Show recordset fields
td = "AAAA"
ca = "BBBB"
pc = "CCCC"
sqlstrInsert = "INSERT INTO " & "Date_Cert_Results (Type_of_Data, Check_Area, Product_Code) values (" & td & "," & ca + "," & pc & ")"
mobjADOConn.Execute (sqlstrInsert)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|