Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problems with Apostroph in variable!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00209007
Message ID:
00209012
Vues:
16
There are a couple of ways to deal with this. You could use [] instead of ' to delimit your string. The easier solution is probably to leave the ALLTRIM(THIS.Value) in your SELECT and use ? to tell VFP it's a parameter. This solution will also work if you're using SQLEXEC() to send your query to a remote data source. Try this:

cMyVar = "ALLTRIM(MyTable.MyField) = ?ALLTRIM(THIS.VALUE)"

>Hello,
>I'm using a variable in the WHERE clause of a SQL Statement. The variable looks like so:
>cMyVar = "ALLTRIM(MyTable.MyField) = '" + ALLTRIM(THIS.VALUE) + "'"
>
>Naturally, if MyTable.MyField contains an apostroph (like "De'Isle"), I get a syntax error :-(
>What do I have to do in this case?
>Thanks in advance for your help!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform