473,513 Members | 2,514 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Single Quotes in DataBase

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
3 1148
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
22742
by: Leif B. Kristensen | last post by:
I'm working with a Python program to insert / update textual data into a PostgreSQL database. The text has single and double quotes in it, and I wonder: What is the easiest way to escape quotes in...
1
6917
by: billmiami2 | last post by:
I'm trying to pass through a SQL statement to an Oracle database using OPENROWSET. My problem is that I'm not sure of the exact syntax I need to use when the SQL statement itself contains single...
7
10528
by: nick.bonadies | last post by:
I'm trying to deal with user inputs of single quotes into form fields that get input into a MSSQL database. So far I have discovered that if I turn on magic_quotes_sybase in my php.ini file PHP...
4
3946
by: pavanponnapalli | last post by:
hi, I need to send some values to a subroutine where i use insert query. suppose say my scalar is as follows: my ($name,$number,$address) etc and i get the values into those...
1
1508
Ciary
by: Ciary | last post by:
hi all, new day, and already a new problem (i'm really posting to much questions :-O ) like specified in an earlier question, i'm using an access database in my website. to get it i'm using a...
1
7101
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7527
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5686
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5090
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3234
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3223
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.