Records Returned or not from a Query

This section contains the codes and resources related to Classic ASP and ASP.net languages.

Records Returned or not from a Query

Postby MT Shahzad on March 21st, 2008, 7:48 pm

How to know if no records were returned:

Code: Select all
'Do database connection
sql = "select this from that where this = 'whatever'"
Set RS = Conn.Execute(sql)

'Do this test
If RS.BOF And RS.EOF Then
     'No records were returned
Else
     'Loop through to show records
End If


By testing to see if the you are at the beginning and the end of the file you will be able to tell if no records were returned.
MT Shahzad
Web/Software Developer
http://mts.sw3solutions.com
User avatar
MT Shahzad
Site Admin
 
Posts: 300
Joined: February 29th, 2008, 8:11 am
Location: Muridke, Pakistan

Return to ASP / ASP.net

Who is online

Users browsing this forum: No registered users and 0 guests

cron