473,508 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Escape single quote in string

DDE
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique
Nov 15 '05 #1
6 22062
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique

Nov 15 '05 #2
Hi,

I think that it depends of the DB engine you are talking to. I would search
on the product documentation first and/or not found I would try escape it
with the same ' , with a " or enclosing the string in [ ]

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique

Nov 15 '05 #3
DDE
Hi,

I am not using Parameters in this case, I am just lookin for a method to do
the thing.

Dominique

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique


Nov 15 '05 #4
DDE
I am not using a constant string but a structure element.

Dominique
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:#4**************@TK2MSFTNGP09.phx.gbl...
Hi,

I think that it depends of the DB engine you are talking to. I would search on the product documentation first and/or not found I would try escape it
with the same ' , with a " or enclosing the string in [ ]

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single
quote?

Thanks

Dominique


Nov 15 '05 #5
Typically, if you Do a string.replace and replace the single quote with
double quotes, it will work for most RDBMS systems. This will do it even if
there's no quote present, the replace will just be ignored. I highly
recommend against this type of methodology, but if you are sure this is what
you want to do...

Dim s As String = "O'Brien"

MessageBox.Show(s.Replace("'", "''"))

"DDE" <dd*@iaireinfo.com> wrote in message
news:O3**************@TK2MSFTNGP11.phx.gbl...
Hi,

I am not using Parameters in this case, I am just lookin for a method to do the thing.

Dominique

"William Ryan" <do********@comcast.nospam.net> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single quote?

Thanks

Dominique



Nov 15 '05 #6
Hi,

At the end you will have to assign the query to OleDbCommand.CommandText ,
this is a string property, this is where you can do the substitution I'm
talking about

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:Or*************@TK2MSFTNGP11.phx.gbl...
I am not using a constant string but a structure element.

Dominique
"Ignacio Machin" <ignacio.machin AT dot.state.fl.us> wrote in message
news:#4**************@TK2MSFTNGP09.phx.gbl...
Hi,

I think that it depends of the DB engine you are talking to. I would

search
on the product documentation first and/or not found I would try escape it with the same ' , with a " or enclosing the string in [ ]

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"DDE" <dd*@iaireinfo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

wich way can I escape a string sent to an OleDbComman containing single quote?

Thanks

Dominique



Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
21398
by: Alden Streeter | last post by:
Here is the HTML that is being output by my asp page: <a href='Files/category/computers/bigimages/computers-sub-monitors.jpg' target='_blank' onMouseOver="window.status='Click for a larger image...
7
96256
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
18
7149
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
7
3947
by: Luminal | last post by:
Greetings I'm having some problems on my C# application. I'm using an access database and I'm not able to do select queries with the ' character. My code is this: // some previous code like...
12
9616
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
6
27746
by: HK guy | last post by:
In C#, it has a escape chatacter @ then can ingnore all the escape charactrer in string, how about in VB.NET, any escape character like @? Thank you
131
9148
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if...
8
21470
by: Marina Levit [MVP] | last post by:
I've scoured google, but apparently none of the suggestions actually work. I have the following. type of XPATH query "SomeNode[SomeAttribute = 'abc's search'" Now, I've tried doing this: ...
3
30650
by: Tiger Champ | last post by:
hi all, I want to output something this way: Select 'This is 'A' book' from ... how to do this?
1
19183
by: crybaby | last post by:
I wrote a python code in linux text pad and copied to thumb drive and try to ran the file by changing the path to windows: sys.path = sys.path + I get the following error: ValueError:...
0
7229
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7061
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
5637
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
5057
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
4716
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
3208
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
3194
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1566
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
769
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.