Message
General information
Fórum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
ID da thread:
01454787
ID da mensagem:
01454788
Views:
56
This message has been marked as the solution to the initial question of the thread.
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
--sb--
Previous
Next
Responder
Mapa
View