Solved

SQL Problems on VC5.0 with ODBC

Posted on 1998-10-14
3
194 Views
Last Modified: 2010-04-02
Hi experts,
I'm looking for the syntax of the sqlstatments that have a ' in the data.
My table has a Entry in Hive like this : [ULM\Dr.Salomon's]
my SQL-statments : SELECT * FROM RegistryEntry WHERE Hive = '[ULM\Dr.Salomon's]';

but the problem is the ' in Dr.Salomon's
what the solution ?
Thanks
jufer
0
Comment
Question by:jufer
3 Comments
 

Expert Comment

by:seanowens
ID: 1175092
Try doubling the single quote.  As far as I know, in normal SQL statements (not under vc5.0/ODBC) thats how you escape the single quote.  I've done it before under different development platforms.
0
 
LVL 3

Accepted Solution

by:
NullTerminator earned 50 total points
ID: 1175093
It is not a function of VC5, but of the ODBC driver and the underlying database.

1) Use double quotes around the literal so the single quote is part of the string.
SELECT * FROM RegistryEntry WHERE Hive = "[ULM\Dr.Salomon's]";

2) use `back quotes` around the string
SELECT * FROM RegistryEntry WHERE Hive = `[ULM\Dr.Salomon's]`;

'\0'
0
 

Author Comment

by:jufer
ID: 1175094
Well
it works when I double it!! Thanks  a lot to \0 and  seanowens.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now