General information
Category:
Database DAO/RDO/ODBC/ADO
Hi All:
I am trying to insert a new record in my table. This table is in sql 2000. As I execute my codes, I get an error. Here is the description of the error I am getting.
"ODBC. The name Zack is not permitted in this context. Only constants,expression or variables allowed here. Column names are not permitted."
Please tell me what am I doing wrong!! Below is my code
Dim dbCommand As New ADODB.Command
Dim strSql As String
dbCommand.ActiveConnection = "DSN=TestConn;UID=sa;pwd=;"
lName = "Zack Ahmed"
lTitle = "DBA"
lAdd1 = "123 Main"
lCity = "Medina"
lState = "OH"
strSql = "Insert M2cexport Id_Name,Ind_Title,M2_Phadd1,M2Phcity,M2_Phstate) " & _
"Values (" & lName & "'" _
& lTitle & "'" _
& lAdd1 & "'" _
& lCity & "'" _
& lState & ")"
dbCommand.CommandText = strSql
dbCommand.Execute
I need all the help I can get
Thanks
MA
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only