473,414 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

adding strings with a quote in SQL

Hi,

I've got a problem with adding strings with a quote in SQL.

Dim LocationName As String = "for' example"

Dim strQuery As String = "select count(*) as fldNumber "

strQuery += "from " & TableName & " "

strQuery += "where " & FieldName & " like ' " & LocationName & "% '
"

What do I have to do to get LocationName into the query and get this
working?

Thanks,

Thierry
Nov 18 '05 #1
3 1444
Thierry wrote:
What do I have to do to get LocationName into the query and get this
working?


You have to "escape" the quote. How you do that depends on the database.
Which database are you using?

--
gabriel
Nov 18 '05 #2
I use SQL-server.
How can I escape the quote.
"gabriel" <no@no--spam.com> wrote in message
news:2f***************************@msgid.meganewss ervers.com...
Thierry wrote:
What do I have to do to get LocationName into the query and get this
working?


You have to "escape" the quote. How you do that depends on the database.
Which database are you using?

--
gabriel

Nov 18 '05 #3
I may be misunderstanding you question - but I run a function that replaces
' with '' (one apostrophie with 2 apostrophies) and I have not had problems
since. I use SQL server also.

bj daniels
da******@gunnery.org

"Thierry" <Th*****@nospam.com> wrote in message
news:x9*******************@phobos.telenet-ops.be...
I use SQL-server.
How can I escape the quote.
"gabriel" <no@no--spam.com> wrote in message
news:2f***************************@msgid.meganewss ervers.com...
Thierry wrote:
What do I have to do to get LocationName into the query and get this
working?


You have to "escape" the quote. How you do that depends on the database. Which database are you using?

--
gabriel


Nov 18 '05 #4

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

Similar topics

32
by: yukatan | last post by:
Maybe it's a newbie question, but if I have two strings, let's say s1="4" and s2="5", how can I get a new string of value "9", that is, add the two numbers. If I type: var newStr = s1 + s2 all I...
5
by: Abhishek Pandey | last post by:
Hi, I have a vector of strings. I want to hold it only unique strings. That is, before adding any new string, I want to check if it is already present, and if yes, then I will not add the new...
47
by: Pierre Barbier de Reuille | last post by:
Please, note that I am entirely open for every points on this proposal (which I do not dare yet to call PEP). Abstract ======== This proposal suggests to add symbols into Python. Symbols...
21
by: Hitesh | last post by:
Hi, I get path strings from a DB like: \\serverName\C:\FolderName1\FolderName2\example.exe I am writing a script that can give me access to that exe file. But problem is that string is not...
4
by: TCook | last post by:
Hey All, I am building a solution which will have many strings that will need to be localized (i.e. strings for toolbars, strings for different WinForms, strings for messages and error messages,...
4
by: rich | last post by:
Here's my code: function doMath() { var grandTot=0; var one=new Array(13); var two=new Array(13); var prod=new Array(13); one = eval(document.form1.BFPpric.value); two =...
17
by: ginajohnst | last post by:
Hi All. I'm having a problem adding days to a date. My date is in the string format dd/mm/yyyy eg. 23/08/2007 in my form field. I can't work out how to add 50 days to that date and then...
12
by: Jeff Gaines | last post by:
I am a hobbyist programmer, using C# and VS2008 and writing desktop apps. I am trying hard to take a modular approach to avoid re-inventing the wheel but I'm finding it a bit frustrating. For...
2
by: Andy B | last post by:
How do you add html content to a string and make it renter in the browser as html? Do you just add the html markup to it? Example would be something like: <asp:CustomControl ID="Control"...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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
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...

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.