Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to handle last_name = 'O'connor' error

Status
Not open for further replies.

adonet

MIS
May 4, 2004
312
US
In SQL statement, if write "where last_name = 'O'connor'"
will cause an error. How to handle it?
 
Depends. Do you want to handle it in the VB code or the SQL code? If VB, then:

Replace(<name as string>, "'", "''")
 
In case that's hard to read, you're replacing the single quote with two single quotes.
 
or use parameters as suggested before.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
I strongly suggest using ADO parameters. Do a Google search for "SQL Injection".

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top