Easy ASP formating question

Results 1 to 4 of 4

Thread: Easy ASP formating question

  1. #1
    Hamsterific Guest

    Default Easy ASP formating question

    How do I put my SQL on seperate lines?<BR>ex. <BR>not this.<BR>SELECT blah FROM blah WHERE blah <BR><BR>but this!<BR>SELECT blah<BR>FROM blah<BR>WHERE blah<BR>ORDER BY blah

  2. #2
    Join Date
    Dec 1969

    Default RE: Easy ASP formating question

    For Example:<BR><BR>ssql = "SELECT People.Title, "<BR>ssql = ssql & "People.Name, "<BR>ssql = ssql & "People.Surname, "<BR>ssql = ssql & "People.SPh "<BR>ssql = ssql & "FROM CourseBookings "<BR>ssql = ssql & "WHERE CourseBookings.CourseId = " & Request("Xid")<BR><BR>set rs=cn.execute(sSQL)<BR><BR><BR>R<BR>

  3. #3
    Join Date
    Dec 1969

    Default Yes...good...*or*...

    Robin&#039s answer is good. Equally good is the following, where an underline character as the last character of a line indicates that the following line is a continuation of the current one. The difference in execution time between the two is miniscule, so it truly is a matter of preference:<BR><BR>&#060;%<BR>ssql = "SELECT People.Title, People.Name, People.Surname, People.SPh " _<BR>&nbsp; &nbsp; &nbsp; &nbsp; &amp; " FROM People, CourseBookings " _<BR>&nbsp; &nbsp; &nbsp; &nbsp; &amp; " WHERE People.CourseID = CourseBookings.CourseId " _<BR>&nbsp; &nbsp; &nbsp; &nbsp; &amp; " AND CourseBookings.CourseId = " & Request("Xid") _<BR>&nbsp; &nbsp; &nbsp; &nbsp; &amp; " ORDER BY People.Surname, People.Name"<BR>%&#062;<BR><BR>I might note that Robin was careful to put a space at the *end* of the lines before his FROM and WHERE clauses. Good practice. I like to *also* put a space in *front* of each clause, just in case I forget the one on the prior line and/or (as in the case of my ORDER BY clause) because it would be silly to tack just a space onto the prior line.<BR>

  4. #4
    Hamsterific Guest

    Default Thanks!

    I appreciate the help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts