>Hi all.
>
>I dunno if this has been addressed anywhere, (I'm sure it probably has, but I haven't been able to find it...)
>
>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 ;-)
>
>Well, this was all fine and dandy, (they didn't complain about it too much), until I started my next project. It involved a web-interfase to my SQL Server database, to which my original FoxPro application is linked.
>
>Needless to say, I can't ask users on the web *not* to use apostrophies, so I had to come up with a solution on both ends, because if web users are inserting apostrophies, the FoxPro application users are going to have to be able to read them...
>
This is a job for CHRTRAN() or STRTRAN() - simply transform the strings substituting something else, or adding the extra ' to each occurance of an ' on the way out to SQL Server, and translating the string back on the way down from SQL Server. Out to SQL Server:
REPLACE cFld WITH STRTRAN(cFld,"'","''")
Coming back:
REPLACE cFld WITH STRTRAN(cFld,"''","'")