Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert
Message
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
Insert
Divers
Thread ID:
00899126
Message ID:
00899126
Vues:
47
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform