Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help working around single quote in string
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01454787
Message ID:
01454807
Views:
40
Thanks Sergey

>A simple fix is to double a single quote as you would do in SQL Server
>
>lcUpdateString = CHRTRAN(lcUpdateString, ['], [''])
>
>
>
>>I have a small issue with when a user adds a single quote ' mark within the string. It doesn't happen real often, but once or twice a month, and the update fails on the sql server side.
>>
>>Example:
>>lcUpdateString=[DC'd and intact]
>>
>>I think I could write a routine that could be called and loop through the string, looking for the ' and putting it inside a set of double quotes. My questions:
>>
>>1. Would that work?
>>2. Would it effect the vfp code below?
>>3. Is there an easy way to do that type of code?
>>
>>
>>VFP Code:
>>
>>lcCmd=[Update dbo.co_Pat_IVTable set ]+lcUpdateTextColumn+[=']+lcUpdateString+[', ]+lcUpdateIDColumn+[= ']+lcNewValues+[']
>>lcCmd=lcCmd+[ where RecordID=?lnUpdateID]
>>
>
>>
>>
>>Thanks for your thoughts, insights, suggestions
>>
>>Kirk
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform