Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Correct Syntax to SQL Server thru ODBC from VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00929617
Message ID:
00930109
Vues:
15
Hi Bernard,
Thanks for the info, but I have tried this with the field list, and I still get an error on the value data. My statement after being built looks like this:
" Insert into temptable (col1) values ("BAR.0000")"
and it still thinks the value "BAR" is a column name.
Since this is Monday, I may just toss the program out the window and come back to it when I have settled down .



>Hi Beth:
>
>You need a parameterized insert statement. Works well on any data type and even if your field values have quotes. I would do something like:
>
>
>lcTableName = "tablename"
>lcFieldValues = "?pcFieldValue1, ?pcFieldValue2, ?pcFieldValue3"
>lcSqlStr = "insert into " + lcTableName + " values(" + lcFieldValues + ")"
>
>
>The field values are variables that must at least be private in scope.
>Also, in the insert statement I find it better to explicitly define the target fields. I.e.,
>
>lcFieldList = "FieldName1, FieldName2, FieldName3"
>lcSqlStr = "insert into " + lcTableName + "(" + lcFieldList + ") " + ;
>    "values(" + lcFieldValues + ")"
>
>
>HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform