Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

(very newbie) question about " ' " in select statement 1

Status
Not open for further replies.

terror

Programmer
Aug 22, 2001
86
US
Hello all,
I'm working on learning asp and sql. I've got a basic security login script and I'm just wondering exactly what the "'" means here on both lines 1 and 2 below. I assume if you use empty quotes like "" then there is no value. Is that right? I don't understand a single quote inside double quotes and I can't seem to find it in tutorials. Is it a shortcut way of writing out something?
1) sqlStr="select * from users where user='"
2) sqlStr=sqlStr & myname & "'"

thanks for putting up with the newbie in me!
-Terror
 
the ' just denotes a string.

Numeric it would be "where user = 2"

string it is "user = 'name'"

Nick

 
thanks Nick. Can you tell me where I can find more info on stuff like that and others things like words inside brackets with exclamation marks in between them []! etc...
I can only find basic sql info online so far. Nothing that goes in depth, and I really need a resource on this stuff. My learning curve is pretty big. (or can you reccomend a good book or something?)
 
Terror,

As to your question about the square brackets, they designate table and field names in Access. As in:

[MyTableName]![MyFieldName]

Access did this because a lot of beginner level Access developers like to create a table with fields like the following:

Employee Table
Employee ID
First Name
Last Name
...

With the square brackets, Access knows that "Employee Table" is the name of the table even though it has a space in it. And the "!" designates that we are talking about a field in that table. When you are talking about a form, it could be:

[MyFormName].[AControlOnTheForm]

I always suggest naming the tables, forms, reports, etc with a logical name that does not include spaces, use the "_" or alternate case to distinguish words. Also, be careful of using reserved words for names. Example, don't have a field called "date" since that is an Access function.

Hope that helps... Terry M. Hoey
 
Thanks Terry,
that does help. I can now at least understand the other posts in the forum's a little better.
much obliged :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top