Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dealing with SQL Server and apostrophies in strings
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00366868
Message ID:
00367274
Vues:
19
Sylvain & Ed -

Thanks for your input! I will discard my function imediately =)

You know what they say - "Use the right tools to simplify the job." - It's amazing how true, as your solution simplifies things greatly. Now I just need to learn what other tools are out there that I should be using!

Thanks again!


>Hi Kile!
>
>Like Ed said, STRTRAN() will do exactly what you need. But the apostrophies problem is present only when sending data to SQL Server. When building your string for SQLExec, just use something like:
>
>cString = [UPDATE Table SET field1='] + STRTRAN(field1, ['], ['']) + [']
>
>(I use brackets [] in those situation because I find it easer to read that double-quotes!)
>
>There is no need to convert [''] back into ['] when you are receiving data from SQLServer.
>
>

>>When I started with my first FoxPro project last year, I ran into the problem of SQL Server not liking strings with apostrophies. I didn't know how to deal with it, so I told the users of my application just not to use apostrophies anywhere (there are only about 10 of them ;-)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform