473,507 Members | 8,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

double quote in sql

I am using vb.net to retrieve data from access mdb.

when I tried to specify a sql string

.... where xyz = "123"

how do I specify the double quote?

I tried use
dim sqlstr = .... & """ & "123" & """

it would not take the last """, complaing end of statement needed.

Please help!

Thanks!

Greg
Nov 21 '05 #1
4 3322

"Greg Chu" <gr******@wendys.com> wrote in message
news:eu**************@TK2MSFTNGP14.phx.gbl...
I am using vb.net to retrieve data from access mdb.

when I tried to specify a sql string

... where xyz = "123"


strSQL = "SELECT ... WHERE xyz = ""123"""
or
strSQL = "SELECT ... WHERE xyz = '123'"

Nov 21 '05 #2
dim sqlStr as String
dim sqlVar as String

sqlVar = "123"
sqlStr = "where xyz = """ & sqlVar & """"

In SQL you should be able to use a Single Quote instead. (Required in SQL
Server.)

sqlStr = "where xyz = '" & sqlVar & "'"

"Greg Chu" <gr******@wendys.com> wrote in message
news:eu**************@TK2MSFTNGP14.phx.gbl...
I am using vb.net to retrieve data from access mdb.

when I tried to specify a sql string

... where xyz = "123"

how do I specify the double quote?

I tried use
dim sqlstr = .... & """ & "123" & """

it would not take the last """, complaing end of statement needed.

Please help!

Thanks!

Greg

Nov 21 '05 #3
"Greg Chu" <gr******@wendys.com> schrieb:
I tried use
dim sqlstr = .... & """ & "123" & """

it would not take the last """, complaing end of statement needed.


Use parameters instead of putting together the SQL command string by hand to
prevent SQL injection:

<URL:http://groups.google.de/groups?selm=eb11vcS0DHA.2604%40TK2MSFTNGP09.phx.gb l>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #4
Greg,

To make the answers not to complicated for you, have a look at the answer
from Noozer,

The other answers are completly beside your question.

Cor
Nov 21 '05 #5

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

Similar topics

24
22555
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
67
9816
by: lcw1964 | last post by:
This may be in the category of bush-league rudimentary, but I am quite perplexed on this and diligent Googling has not provided me with a clear straight answer--perhaps I don't know how to ask the...
17
2468
by: arindam.mukerjee | last post by:
I was running code like: #include <stdio.h> int main() { printf("%f\n", 9/5); return 0; }
11
3680
by: Ole Nielsby | last post by:
First, sorry if this is off-topic, not strictly being a C++ issue. I could not find a ng on numerics or serialization and I figure this ng is the closest I can get. Now the question: I want...
14
31483
by: kanepart2 | last post by:
Hi guys, I am having a problem with the following code snippet:- double x = (myReader); double y = (myReader); Resulting in the follwing compilation error: Cannot implicitly convert type...
1
9388
by: perroe | last post by:
Hi I have a array of complex numbers that are stored in a simple double array. This is done since the array is part of an wrapper for an external C library, and the imaginary part of the first...
29
2929
by: Virtual_X | last post by:
As in IEEE754 double consist of sign bit 11 bits for exponent 52 bits for fraction i write this code to print double parts as it explained in ieee754 i want to know if the code contain any...
206
13093
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
4
1297
by: Nangi | last post by:
Hi, I've got a problem with this code. I've got a double Matrix A and a vector b, initialized with DoubleMatr A = new double*; DoubleVect b = new double; where DoubleMatr and DoubleVect are...
2
5076
by: clintonb | last post by:
Victor said: The double value that I'm trying to convert to GCSMoney (which is implemented as cents) was produced by multiplying a dollar amount by an interest rate to get interest. double...
0
7372
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...
1
7029
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
7481
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
5619
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
5039
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
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
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
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.