Sngle Quotes in SQL statements

T

Tony Van

There was an issue in VB6 with single quotes causing
problems. I remember
having to write a function to replace the single quote with
double quotes
when dealing with name likes O'Bannon in SQL statements.

Does this issue still exist in VB.NET SQL?

I'm using an ACCESS database and OleDb.

Thanks.....
 
W

William \(Bill\) Vaughn

I refer to this as the "O'Malley Issue". Yes, it's still an issue and will
be in the foreseeable future. The solution is to use Command objects and
parameters instead of ad hoc queries.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
G

Guest

In C#, a single quote is not considered a special character. I don't know if
it's the same in VB. Any special characters can be ignored using the
backslash (\) escape sequence. string op = "This \" quotation mark is ignored"

Try that.
Hope that helps
 
W

William \(Bill\) Vaughn

This is NOT a VB, VB.NET or C# issue. It's a SQL issue.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top