Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dealing with SQL Server and apostrophies in strings
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00366868
Message ID:
00366992
Views:
14
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 ;-)
Sylvain Demers
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform