I'm trying to update a field from a form using parameters but it will not accept single quotes. It just cuts off the text, so "Bill's Record" would just be updated as "Bill".
The solution on all the web pages I've seen, i.e. replacing the single quotes with two single quotes doesn't work. It does exactly the same thing. This is part of the code...
cmd.Parameters.Add("@id", SqlDbType.Int).Value = parID
parName=replace(parName,"'","''"
cmd.Parameters.Add("@name", SqlDbType.VarChar, 255).Value = parName
I can't change any database fields nor can I remove the quotes, so I need to get this working. Does anyone have any ideas. parName is being assigned correctly (e.g. "Bill''s Record" but SQL Server thinks two quotes is the same as one.
The solution on all the web pages I've seen, i.e. replacing the single quotes with two single quotes doesn't work. It does exactly the same thing. This is part of the code...
cmd.Parameters.Add("@id", SqlDbType.Int).Value = parID
parName=replace(parName,"'","''"
cmd.Parameters.Add("@name", SqlDbType.VarChar, 255).Value = parName
I can't change any database fields nor can I remove the quotes, so I need to get this working. Does anyone have any ideas. parName is being assigned correctly (e.g. "Bill''s Record" but SQL Server thinks two quotes is the same as one.