G
Guest
Hi there - I'm sure there is a simple answer to this ?!? - I just don't know
it...
I have several text boxes on an asp.NET web page that are used to gather
information from the user and then sent to a SQL database - they are
basically editing new or existing records.
When any text is entered in one of the free text boxes and the user uses an
' (such as - didn't manage to get through - the insert or update statement to
SQL treats the apostrophe as a break in the statement....
e.g.
Dim UserAnswer as String = txtUserAnswer.Text
Dim updateCmd as string = "Update DATABASE Set ANSWER = ' " & UserAnswer & "
' "
(obviously there are not really all the spaces between the " and ' but I
have put them in to highlight what I have in what order
If I then use updateCmd as the SQL update command and they have used an
apostrophe in the text box, the update fails with incorrect syntax in SQL
statement or something similar - obviously if no apostrophe is used it works
fine...
Your thoughts & advice are appreciated
Stuart
it...
I have several text boxes on an asp.NET web page that are used to gather
information from the user and then sent to a SQL database - they are
basically editing new or existing records.
When any text is entered in one of the free text boxes and the user uses an
' (such as - didn't manage to get through - the insert or update statement to
SQL treats the apostrophe as a break in the statement....
e.g.
Dim UserAnswer as String = txtUserAnswer.Text
Dim updateCmd as string = "Update DATABASE Set ANSWER = ' " & UserAnswer & "
' "
(obviously there are not really all the spaces between the " and ' but I
have put them in to highlight what I have in what order
If I then use updateCmd as the SQL update command and they have used an
apostrophe in the text box, the update fails with incorrect syntax in SQL
statement or something similar - obviously if no apostrophe is used it works
fine...
Your thoughts & advice are appreciated
Stuart