How to search "O'Neal" using SQL

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

I have my access database with a list of student's names, some student has
the name as O'Neal.. when i am doing a search in my windows applicaiton sql
queries, i couldn't search for it coz it will throw a syntax error exception
(the sql is: SELECT * FROM tblStudent WHERE Name='O'Neal';)

Since there is a quote in between the name, it throws a syntax error.. i was
told by my friends that i can use three quotes to get around this but the
exception still comes up...
Is there any way to aviod this?
Thanks
 
Hi Tony
I have my access database with a list of student's names, some student has
the name as O'Neal.. when i am doing a search in my windows applicaiton sql
queries, i couldn't search for it coz it will throw a syntax error exception
(the sql is: SELECT * FROM tblStudent WHERE Name='O'Neal';)

I propose: SELECT * FROM tblStudent WHERE Name='O''Neal';

Use two single-quote chars works in my ADODC experience.
Since there is a quote in between the name, it throws a syntax error.. i was
told by my friends that i can use three quotes to get around this but the
exception still comes up...
Is there any way to aviod this?
Thanks

Regards

Marcin Grzêbski
 
Back
Top