Stefan Motz
asked on
Insert single quote in Classic ASP
Hi Experts,
I'm trying to insert last names like O'Neil into my database, but it gives me an error because of the single quote in the last name.
It works with names without single quotes.
This is how I'm doing it:
sLast_Name=rs2("Last_Name" )
Ho can I rewrite this so that it accepts single quotes.
Thank you
I'm trying to insert last names like O'Neil into my database, but it gives me an error because of the single quote in the last name.
It works with names without single quotes.
This is how I'm doing it:
sLast_Name=rs2("Last_Name"
Ho can I rewrite this so that it accepts single quotes.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
of course, using parameterized queries would be much simpler and safer to do
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much for your help. This also solved the problem:
sLast_Name=replace(rs2("La st_Name"), "'","''")
sLast_Name=replace(rs2("La