Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data update in SQL Server
Message
De
25/11/2006 15:20:05
 
 
À
24/11/2006 10:05:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01172264
Message ID:
01172426
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
Hi,

use parameters markers instead.

e.g.
lcSQL = 'UPDATE yourTable SET field1 = ?yourVariable1, field2 = ?yourVariable2 WHERE primary_key = ?yourPK'
?SQLEXEC(lnConnection,lcSQL)
there are several advantages to this approach:
-the SQL statement will be fixed lenght and does not depent on the data beeing send
-the SQL statement cannot be invalidated by the data beeing sent, with your current approach when a variable contains a ' character for example the SQL statement is no longer valid (variable content: "St' something" - SQL: SET someField = 'St' something')
-you don't have to deal with the datatype conversions, FoxPro knows howto correctly pass parameters in a SQL statement

Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform