Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Interpreting Statements in ASP

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,172
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Interpreting Statements in ASP
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Interpreting Statements in ASP - 6/16/2001 4:00:24 AM   
  jordan

 

Posts: 9
Score: 0
Joined: 6/9/2001
From: USA
Status: offline
I have a SELECT statement that needs to select 3
fields from a table:

Grace="SELECT Date1, Date2, 'Consumed' Status" & _
"FROM Table1 WHERE Upper(UserID)='" & UserIDGrace & "'"
Grace=Grace & "Order By Status DESC, Date1 ASC"

1. Why will my ASP page display 'Consumed' under 1 of the fields
on in the table displayed when <'Consumed' Status"> is not a
field in Table1? What does <Upper(UserID)> do?
2. What are the <& _> behind <'Consumed' Status"> used for?
3. Why is UserIDGrace enclosed in <'" & & "'>?
4. What is DESC and ASC used for?
5. What is 'wend' used for? is it used to end the program?

THANX !
 
 
Post #: 1
 
 Re: Interpreting Statements in ASP - 6/16/2001 4:02:30 AM   
  Mighty

 

Posts: 11
Score: 0
Joined: 5/22/2001
From: USA
Status: offline
In rough order;

1. Where you have 'Consumed' Status, your database is probably interpreting this as a user-defined field. By
entering 'Consumed' Status, you're basically saying "display a column called Status and enter 'Consumed' as its
value".

For example, "select 'Andy' as Name" will display a column called name and fill in the value 'Andy'.

Upper converts the value you pass to it to upper-case, usually for case-sensitive comparison purposes. So,
Upper('andy') returns 'ANDY'.

2. & is used by VBScript/VB/VBA to concatenate a string; that is "My" & "String" becomes "MyString". Be careful
not to mix up & and + and check your database documentation for the differences between concatentation and
addition operators, otherwise you might get some funny results.

3. The statement you're building is a string that will probably be passed to a database to execute, hence the &
operators. The underscore means "continue on this line" and is just a way of breaking a single statement down
onto multiple lines.

So;

statement1 _
statement2 _
statement3

is the same as statement1 statement2 statement3

4. DESC is SQL for "order this field in descending order" - ASC I assume means ascending, though this is the
default and I've never seen it used before.

5. This is VBScript/VB/VBA for "end a while conditional loop" - it needs to accompany a While statement;

for example;

While (Not rs.EOF)
' do statements
rs.MoveNext
WEnd

Hope this helps.

(in reply to jordan)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Interpreting Statements in ASP Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts