By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,822 Members | 1,025 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,822 IT Pros & Developers. It's quick & easy.

Using Single Quotes in DataBase

P: n/a
I have a database which has a field "myfield" that has a value "Owner's Text
Book". I am trying to construct an sql query to find the record where
myfield equals "Owner's Text Book". How do I get the Sql query to accept
the single quote as part of the string I'm looking for,i.e.,

Select * FROM myTable WHERE myfield = 'Owner's Text Book'. The OLEDB query
command interprets the ' in Owner's as a delimiter.
--
Dennis in Houston
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
Dennis,

I am not sure of this however did you already try to use parameters?

It is easy to use.
See this sample on our site for SQL server (there is as well a little bit
more complex sample for OleDb)
http://www.windowsformsdatagridhelp....6-7139b8970071

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
You just have to make it a double-single-quote:

Select * FROM myTable WHERE myfield = 'Owner''s Text Book'

"Dennis" <De****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
I have a database which has a field "myfield" that has a value "Owner's
Text
Book". I am trying to construct an sql query to find the record where
myfield equals "Owner's Text Book". How do I get the Sql query to accept
the single quote as part of the string I'm looking for,i.e.,

Select * FROM myTable WHERE myfield = 'Owner's Text Book'. The OLEDB
query
command interprets the ' in Owner's as a delimiter.
--
Dennis in Houston

Nov 21 '05 #3

P: n/a
Thanks...that works!
--
Dennis in Houston
"Terry Olsen" wrote:
You just have to make it a double-single-quote:

Select * FROM myTable WHERE myfield = 'Owner''s Text Book'

"Dennis" <De****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
I have a database which has a field "myfield" that has a value "Owner's
Text
Book". I am trying to construct an sql query to find the record where
myfield equals "Owner's Text Book". How do I get the Sql query to accept
the single quote as part of the string I'm looking for,i.e.,

Select * FROM myTable WHERE myfield = 'Owner's Text Book'. The OLEDB
query
command interprets the ' in Owner's as a delimiter.
--
Dennis in Houston


Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.