|
-
Jun 18th, 2003, 04:00 PM
#1
Thread Starter
Lively Member
question on sql
I have a tmpsql
tmpsql = Select * From Customer where Customer.Customer_Name = "Jon"
only problem is, u have to have the sql statement in " "
and when it gets to the "Jon" it believes it's the end of the variable, how to I make vb include " in the string?
Vini, Vidi, Vici!
-----------------
say this 5 times fast
"I am not a pheasant plucker, I'm a pheasant plucker's son. I'm only plucking pheasants, till the pheasant plucker comes."
-
Jun 18th, 2003, 04:07 PM
#2
Use single quotes to surround your string criterias.
VB Code:
tmpsql = "Select * From Customer where Customer.Customer_Name = 'Jon'"
-
Jun 18th, 2003, 04:14 PM
#3
Addicted Member
Another way to put " into your strings is to use it twice.
ie:
VB Code:
Dim str As String
str = "My name is Bob ""Wild"" Smith"
MsgBox str
But brucevde is right in that you should use the single quotes ' around strings. I think some versions of SQL only use the single quotes. (But I have been known to be wrong.) However, it doesn't hurt to use them. 
Destined
-
Jun 18th, 2003, 04:58 PM
#4
Thread Starter
Lively Member
thanks that works, although in a msgbox it shows up as a ' and not a " but it works so who cares :-)
Vini, Vidi, Vici!
-----------------
say this 5 times fast
"I am not a pheasant plucker, I'm a pheasant plucker's son. I'm only plucking pheasants, till the pheasant plucker comes."
-
Jun 18th, 2003, 05:19 PM
#5
Addicted Member
Originally posted by Inimicum
thanks that works, although in a msgbox it shows up as a ' and not a " but it works so who cares :-)
I just tested mine (cut'n pasted into program) and it came out using "
Oh well. 
Destined
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|