March 1, 2002 at 6:43 am
Hi guys, I got this error whenever I tries to input a value with an apostrophe sign, for example "Mary's book", the apostrophe after Mary will be mistaken by the SQL server as the end of the statement and gives me the following error:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near 's'.
/emtap/process_registration.asp, line 249
How do I go about solving this? Thanks!
March 1, 2002 at 6:49 am
Submit as "Mary''s book", in your app just do a replace ' for '' before submitting.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
March 1, 2002 at 6:53 am
quote:
Submit as "Mary''s book", in your app just do a replace ' for '' before submitting."Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
So your suggestion is; either the user enters double quote or I can do the replacement for the apostrophe in my application?
Edited by - macer on 03/01/2002 06:56:07 AM
March 1, 2002 at 7:36 am
Sorry, I meant one single quotes (') must be submitted as two singles ('') not a double.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
March 1, 2002 at 8:39 am
If you're using an ADO command object or passing the parameters directly in a connection.execute you typically do something like this: replace("Mary's","'","''"). If you assign the value to a field in a ADO recordset ADO handles the quoting issue for you.
Andy
March 6, 2002 at 12:22 pm
here is a function I include in all my asp pages that have text fields that can can accept input.
function SQLparse(s)
'*********************************************
'* This just does a charater replacement on my
'* insert and update sections
'* so I don't blow up the database.
'*********************************************
dim tmp
tmp = s
tmp = replace(tmp, "’", "'")
tmp = replace(tmp, "`", "'")
tmp = replace(tmp, "'", "''")
SQLparse = tmp
'SQLparse end
end function
good luck
Wes
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply