|
-
Mar 31st, 2000, 05:42 PM
#1
Thread Starter
New Member
What does the & _ symbols represent in an SQL statement?
e.g.
strSQL = "SELECT name, age FROM table WHERE " & _
"name = '" &name& "'"
Why are they in separate lines and what is the function of the "& _" symbol represented above?
-
Mar 31st, 2000, 10:43 PM
#2
Fanatic Member
The & _ is not part of the SQL statement. All that does is allow you to spread a statement over more than one line.
This
Code:
strSomeString = "some text in a string"
strSomeString = strSomeString & "more text for the string"
strSomeString = strSomeString & "yet more text"
Is the same as this
Code:
strSomeString = "some text in a string" & _
"more text for the string" & _
"yet more text"
-
Apr 2nd, 2000, 07:21 PM
#3
New Member
"name = '"&name&"'"
it means that the second name ('"&name&"') is parameter
eg.
name = &_
inputbox("Enter Your name ? ")
strSQL = "SELECT name, age FROM table WHERE" &_
"name = '"&name&"'"
data1.recordsource = strsql
it means that data1 recordsource will contain records which has name same with the name that you enter through the inputbox.
thanks
bambang
-
Apr 2nd, 2000, 09:16 PM
#4
Lively Member
Hi there,
1.)
you can use a & to join two strings:
e.g.
string1 = "Hello "
string2 = "World!"
newstring = string1 & string2 '--> "Hello World"
2.)
with the underscore _ you can insert a linebreak into your code without VB complaining about it
however there has to be a space before the underscore
e.g.
Code:
if (condition2 or condition2) and condition3 _
then dowhateveryouwant
without the underscore VB would complain
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
|