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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Single Quote problem when connecting to Oracle db

Status
Not open for further replies.

flip79

MIS
Jul 5, 2002
23
0
0
US
Hi,

I would greatly appreciate it if anyone could help me figure out how to pass a SQL string to an Oracle database if the where criteria has a single quote in it somewhere.

For Example:

Select * From tblTitle Where Title = "A Book's Title"

I tried using this statement below where me.txtTitle = "A Book's Title":

strSQL = "Select * from tblTitle Where Title = " & CHR$(34) & me.txtTitle & CHR$(34)

but this didn't work.

I know in Oracle you must "SET SCAN OFF" and put another single quote in front of the existing quote, but I'm not sure how to do this in VB.

Help Please!!
 
Assuming that you are using ADO, take a look at faq709-1526. You will want to use something similar to a stored procedusr and it is not Oracle specific but the same principles apply.

Thanks and Good Luck!

zemp
 
I can't get to your link. Can you post the entire address?

Thanks for your help!!!
 
flip79 -

Even though my FAQ is for SQL Server, all the same concepts still apply when using Oracle. You'll want to follow some of the links in the FAQ and read some of the technical articles (Zemp provided most of the links, and they're excellent).

Chip H.


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

Part and Inventory Search

Sponsor

Back
Top