February 16th, 2013, 02:33 AM
Problem with ASP SQL single quote when insert or select
we are facing issue with inserting or selecting records when user enter anything with ' (single quote) in text field. We dio not want to replace this. we need to enter this as single quote ' in oour dabtase. when user use this then our query getting break. what can be the solution
for example if use enter " This is Gaurav's Farm" then break coz of single quote
February 21st, 2013, 12:15 PM
I believe you must remove/replace it. You could use something similar such as a ` and then you could swap it back at the database end.
February 28th, 2013, 11:21 AM
use recordset and you do not need to replace anything below example schema how to do that
sql="select * from yourTable where 1=0"
constr="" ' your connection string
rs.open sql, cn, 1, 3 ' keyset lock optimistic
if you found this post is useful click Give Rep button (bottom side on this reply ) and agree