Interpreting Statements in ASP

Author Message
jordan

  • Total Posts : 9
  • Scores: 0
  • Reward points : 0
  • Joined: 6/9/2001
  • Location: USA
  • Status: offline
Interpreting Statements in ASP Saturday, June 16, 2001 5:00 AM (permalink)
0
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 !


 
#1
    Mighty

    • Total Posts : 8
    • Scores: 0
    • Reward points : 0
    • Joined: 5/23/2001
    • Location: USA
    • Status: offline
    Re: Interpreting Statements in ASP Saturday, June 16, 2001 5:02 AM (permalink)
    0
    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.

     
    #2

      Online Bookmarks Sharing: Share/Bookmark

      Jump to:

      Current active users

      There are 0 members and 1 guests.

      Icon Legend and Permission

      • 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
      • Read Message
      • Post New Thread
      • Reply to message
      • Post New Poll
      • Submit Vote
      • Post reward post
      • Delete my own posts
      • Delete my own threads
      • Rate post

      2000-2012 ASPPlayground.NET Forum Version 3.9