Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 recordset record count

Author  Topic 

olay80
Yak Posting Veteran

62 Posts

Posted - 2005-08-17 : 04:00:30
hey guys,

i'm working some vb code and i need to know how to count the records in a recordset.

thanx,
Oliver

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-17 : 04:47:17
>>i'm working some vb code and i need to know how to count the records in a recordset.

Set the cursor Location of the Recordset to aduseClient

Then recordset.recordcount will show the record count

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-08-17 : 06:21:11
SELECT * FROM MyTable
SELECT [RowCount] = @@ROWCOUNT

would do it - but you would have to process the first recordset to get to the second one which has the answer!

A variation on that theme would be:

SELECT [RowCount] = COUNT(*) FROM MyTable WHERE ...
SELECT * FROM MyTable WHERE ...

Kristen
Go to Top of Page
   

- Advertisement -