Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Insert into SQL with a '
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01670208
Message ID:
01670213
Vues:
100
This message has been marked as the solution to the initial question of the thread.
J'aime (1)
>hi all,
>I'm trying to insert (and update) into an SQL Server table but I get an error when a name contains a ' e.g. Michael O'Reilly
>The code in summary is below, I've also tried variations of &lcName, (lcName) etc. but no joy
>
>lcSQLcommand = "INSERT into Contacts (" + ;
>			"Contact_Name " + ;
>			")" + ;
>		"Values (" + ;
>			" '" + lcName + "'" + ;
>			")"
>
>SQLEXEC(lnSQLHandler, lcSQLcommand)
>
>~M

Try to use parameters instead:
text to lcSQLCommand noshow
Insert into Contacts ([Contact Name]) 
values (?m.lcName)
SQLEXEC(lnSQLHandler, lcSQLcommand)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform