Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Vfp -> sql server Insert cmd syntax error
Hi, all
I am working in vfp 6 and MSDE (soon to go up to SQL server). I am using SQL pass-thru.
I am trying to execute the following code several different ways, but keep getting errors from the server:
lcVal1 = "Walsh"
lcVal2 = "Elizabeth"
lcSQLstr = 'INSERT INTO studnt (last_name_, firstname_, studnt_id_ )' + ;
' VALUES ('+ lcVal1 + ',' + lcVal2 + ',' + '1)'
llReturnVal=SQLEXEC(ghConnectionhandle,lcSQLstr)
lcSQLstr = 'INSERT INTO studnt (last_name_, firstname_, studnt_id_ )' + ;
' VALUES ( "Walsh", "Elizabeth", 1)'
llReturnVal=SQLEXEC(ghConnectionhandle,lcSQLstr)
forgot to add the error: Walsh is a column name and cannot be used.
any ideas on how to fix this?
TIA
Beth
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement