Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: checking on empty recordset


Message #1 by "Eric Van Camp" <eric.vancamp@c...> on Wed, 22 Nov 2000 17:03:45 -0000
 i need to display a message when the recordset is empty..

is their a property 

while rs.empty or something like that to check?

txs

eric

Message #2 by "David BG" <johnson_bg@h...> on Wed, 22 Nov 2000 18:43:57 -0000
strSQL = "SELECT * FROM tableName"

rsRecordset.open strSQL, <..objConnection> ,

                  <..adOptionConstant>, adcmdText



if rsRecordset.EOF = 0 Then   'Testing if the recordset/whole table

                                is  empty

    'Do something

End If





----Original Message Follows----

From: "Eric Van Camp" <eric.vancamp@c...>

Reply-To: "ASP Databases" <asp_databases@p...>

To: "ASP Databases" <asp_databases@p...>

Subject: [asp_databases] checking on empty recordset

Date: Wed, 22 Nov 2000 17:03:45 -0000



  i need to display a message when the recordset is empty..

is their a property

while rs.empty or something like that to check?

txs

eric



Message #3 by "Joe Sabado" <joe.sabado@g...> on Wed, 22 Nov 2000 10:14:47 -0800
if rs.eof then '  -- recordset is empty

----- Original Message -----

From: "Eric Van Camp" <eric.vancamp@c...>

To: "ASP Databases" <asp_databases@p...>

Sent: Wednesday, November 22, 2000 9:03 AM

Subject: [asp_databases] checking on empty recordset





> i need to display a message when the recordset is empty..

> is their a property

> while rs.empty or something like that to check?

> txs

> eric

>

Message #4 by "Ken Schaefer" <ken@a...> on Thu, 23 Nov 2000 09:53:13 +1100
> if rsRecordset.EOF = 0 Then



I don't think you should do it this way



<%

If objRS.EOF

%>



returns TRUE or FALSE, it does not return a numeric value, so do not test to

see if it is equal to a numeric value. Do it this way instead:



If objRS.EOF then

    ' No records

Else

    ' There are records

End if



Cheers

Ken



----- Original Message -----

From: "David BG" <johnson_bg@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, November 23, 2000 5:43 AM

Subject: [asp_databases] Re: checking on empty recordset





> strSQL = "SELECT * FROM tableName"

> rsRecordset.open strSQL, <..objConnection> ,

>                   <..adOptionConstant>, adcmdText

>

> if rsRecordset.EOF = 0 Then   'Testing if the recordset/whole table

>                                 is  empty

>     'Do something

> End If

>

>

> ----Original Message Follows----

> From: "Eric Van Camp" <eric.vancamp@c...>

> Reply-To: "ASP Databases" <asp_databases@p...>

> To: "ASP Databases" <asp_databases@p...>

> Subject: [asp_databases] checking on empty recordset

> Date: Wed, 22 Nov 2000 17:03:45 -0000

>

>   i need to display a message when the recordset is empty..

> is their a property

> while rs.empty or something like that to check?

> txs

> eric

>

>

Message #5 by "jigs gandhi" <newsgroup@h...> on Thu, 23 Nov 2000 09:30:57 +0530
This is a multi-part message in MIME format.



------=_NextPart_000_01BA_01C05530.15943700

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



hi,



you must be doing



do while not rs.eof

    ... code....

    rs.movenext

loop



just add



if not rs.eof then

    do while not rs.eof

        ... code....

        rs.movenext

    loop

else

    your NO RECORDS FOUND message

end if



jigs

  ----- Original Message -----

  From: Eric Van Camp

  To: ASP Databases

  Sent: Wednesday, November 22, 2000 10:33 PM

  Subject: [asp_databases] checking on empty recordset





  i need to display a message when the recordset is empty..

  is their a property

  while rs.empty or something like that to check?

  txs

  eric



  ---

  NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS?  Is FREE okay?

  Visit EarthWeb for the latest in IT Management, Software Development,

  Web Development, Networking & Communications, and Hardware & Systems.  



  Click on http://www.earthweb.com for FREE articles, tutorials,

  and discussions from the experts.




$subst('Email.Unsub')










Message #6 by "MARK HORNER" <hornermj@h...> on Thu, 23 Nov 2000 09:29:29
Try using rs.RecordCount property



David Sussman's ADO 2.6 is a good guide.



Rgds



M



Message #7 by "Ken Schaefer" <ken@a...> on Fri, 24 Nov 2000 12:43:12 +1100
Are you suggesting that you use .RecordCount to check for an empty

recordset?



Not a good idea.



Test for .EOF instead - much less expensive. Why? .Recordcount relies on

using expensive static/keyset, or client-side cursors.



Instead, use the less expensive alternatives.

If you're using .getRows(), then isArray() will tell you if you have any

records, otherwise, just test for .EOF if you're using the ADO Recordset

object.



Cheers

Ken



----- Original Message -----

From: "MARK HORNER" <hornermj@h...>

To: "ASP Databases" <asp_databases@p...>

Sent: Thursday, November 23, 2000 9:29 AM

Subject: [asp_databases] checking on empty recordset





> Try using rs.RecordCount property

>

> David Sussman's ADO 2.6 is a good guide.

>

> Rgds

>

> M






  Return to Index