473,811 Members | 3,521 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 22080
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo. com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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******** ********@TK2MSF TNGP11.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********@com cast.nospam.net > wrote in message
news:eq******** ******@tk2msftn gp13.phx.gbl...
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo. com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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.mach in AT dot.state.fl.us > wrote in message
news:#4******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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******** ******@TK2MSFTN GP11.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********@com cast.nospam.net > wrote in message
news:eq******** ******@tk2msftn gp13.phx.gbl...
Use an OledbParameter instead and let it take care of it for you.
"DDE" <dd*@iaireinfo. com> wrote in message
news:%2******** ********@TK2MSF TNGP11.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.Co mmandText ,
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******** *****@TK2MSFTNG P11.phx.gbl...
I am not using a constant string but a structure element.

Dominique
"Ignacio Machin" <ignacio.mach in AT dot.state.fl.us > wrote in message
news:#4******** ******@TK2MSFTN GP09.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******** ********@TK2MSF TNGP11.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
21413
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 of MONITOR, 19\" CODAR EAGLE.';return true;" onMouseOut="window.status='';return true;"> <img width='98' height='96' border='0' src='Files/category/computers/bigimages/computers-sub-monitors.jpg' alt='MONITOR, 19" CODAR EAGLE'></a>
7
96340
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 %% should be used. Wouldn't it have been better (from design perspective) if the same escape character had been used in this case too. Forgive me for posting without verfying things with any standard compiler, i don't have the means for now.
18
7199
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 QID=\"55111\"><Tag2 AID=\"5511101\"></Tag2></Tag1><Tag1 QID=\"55112\"><Tag2 AID=\"5511217\"></Tag2></Tag1><Tag1 QID=\"5512282\"><Tag2 AID=\"551228206\"></Tag2></Tag1><Tag1 QID=\"55114\"><Tag2 AID=\"5511406\"></Tag2></Tag1><Tag1 QID=\"55115\"><Tag2
7
3965
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 open connection string sqlStatement="SELECT oid FROM formatos WHERE formato='cd\\'s'";
12
9648
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(" & Chr(34) & PopUpWindowTitle & Chr(34) & ", " & Chr(34) & CurrentEventDetails & ")" strTemp += "<BR><A HREF='#' onClick='" & PopupLink & "'>" & EventName & "</A><BR>" The problem I have is that when the string variables or contain a string with an...
6
27794
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
9306
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 you pass a second argument of True (the default is False): 'the "quick" &amp; &lt;brown&gt; fox' 'the &quot;quick&quot; &amp; &lt;brown&gt; fox' This seems to me to be dumb. The default option should be the safe one: that is, escape _all_ the potentially troublesome...
8
21485
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: "SomeNode[SomeAttribute = 'abc@apos;s search'"
3
30673
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
19358
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: invalid \x escape I am pretty sure this problem is due some kind of linux end of line
0
9726
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10395
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7667
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4338
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 we have to send another system
2
3865
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.