Tech Tips
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How do I escape single quotes in SQL queries?

Go down

How do I escape single quotes in SQL queries? Empty How do I escape single quotes in SQL queries?

Post  Admin Sat Aug 08, 2009 2:12 pm

I am trying to run a SQL Select statement which looks like this:

"SELECT * FROM TableName WHERE FieldName = '" + Request.QueryString("ProNumber") + "'"

But, I am getting a End of statement expected error. The value passed in contains a single quote. Is it a problem?

Soln:
"SELECT * FROM TableName WHERE FieldName = '" + replace(Request.QueryString("ProNumber"), "'", "''") + "'"
Web Reference:
How do i escape single character

Admin
Admin

Posts : 60
Join date : 2009-06-05

https://softro.forumotion.net

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum