Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing a recordset 1

Status
Not open for further replies.

johnaregan

Programmer
Mar 13, 2001
87
Hi all
If I execute a query using ADO and assign the resulting recordset to a variable rs then how can I test to see if ADO found any records.

thx in advance
 
using the "count" property
----------------------
<%
Set Conn = server.CreateObject(&quot;ADODB.Connection&quot;)
Conn.Open &quot;......&quot;
Set RS = Conn.Execute(&quot;SELECT Count(*) AS Recs FROM [yourtable]&quot;)%>

Records Found&nbsp; <%=RS(&quot;Recs&quot;)%>


DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Or you can use the empty recordset test of:

if (rs.eof and rs.bof) then
'rs is empty
else
'rs is not empty
end if

That condition will be true only if the recordset is empty.

:)
Paul Prewett
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top