Quick simple question

Results 1 to 2 of 2

Thread: Quick simple question

  1. #1
    Join Date
    Dec 1969

    Default Quick simple question

    I am using a bit of a unelegant way to tell if a record was returned from a SQL select statement.<BR><BR>I for example do Select * from tbl_x where email = &#039;johncogan@blah.net&#039; and then loop through the RS (recordset) checking if a match was made. If no match was made I set a flag.<BR><BR>I was thinking there must be a better method within the SQL that will allow me to check if anything was returned ?<BR><BR>Does a SQL query return a -1 if nothing was returned ?

  2. #2
    Join Date
    Dec 1969

    Default Quick simple answer

    &#060;%<BR>SQL = "SELECT * FROM tbl_x WHERE EMail = &#039;...&#039;"<BR>Set RS = conn.Execute( SQL )<BR>If RS.EOF Then<BR>&nbsp; &nbsp; Response.Write "No matching email address found."<BR>&nbsp; &nbsp; Response.End<BR>End If<BR>%&#062;<BR><BR>The recordset will be empty if nothing was returned, so EOF will *immediately* be set to true. Simple as that.<BR><BR>

Posting Permissions

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