You are here: irt.org | FAQ | ASP | Q5822 [ previous next ]
From time to time an application will execute a SQL query that's supposed to retrieve something, but doesn't. Whatever the underlying reason, it's important to handle this case.
You should always encapulsate any code that depends on data being returned in a control flow structure (see examples).
<% ' EXAMPLE 1 ' LOOP THROUGH SOME RECORDS ' AND WRITE THEIR VALUES TO THE ' BROWSER. The not RS.EOF MEANS ' NOT YET AT THE END OF FILE do while not RS.EOF response.write RS("fieldName") loop ' EXAMPLE 2 if RS.EOF then response.write "No records were returned" else ' DO SOMETHING WITH THE RECORDS end if %>