View Full Version : updating filed with ' in it

Sep 13th, 2005, 07:21 PM
Hi I have a field that may have a ' in it and seeing as though it is a text field in the update statement that I am building i have

update table set field = ' " & str & " ' "

if the str variable has a ' in it the it returns an error, how can i get around this, thanks for any input

Sep 13th, 2005, 08:17 PM
Did you mean to put this in the Classic ASP forum?

Sep 14th, 2005, 04:16 AM
If you're using ASP.NET and using its built in web controls and use CommandParameters with the SqlCommand class, this is a total non-issue.

Sep 14th, 2005, 06:44 PM
I am using a datagrid with the oneditcommand and onupdatecommand, it was giving me an error where there was a ', so what i did was i replaced the ' with '' (2 single quotes) and then the sql stmt ran fin bc asp.net treats '' as a single quote in a string surrounded by double quotes. Just thought I'd share that incase anyone else is having that trouble