counting records with a datareader

chantellex

New Member
how would I find how many records are contained in a datareader without using (count = count + 1) as the reader reads? I cannot seem to find a property of the datareader to perform this simple task.You can't. Just like in classic ADO/ASP, with a read-only, firehose cursor Recordset, you couldn't use .RecordCount. One option is to do a SQL statement that gets the specific number of records, or adding a subquery in the SELECT clause to compute the total number of records, or something of that nature.<BR><BR>Like a:<BR><BR>SELECT COUNT(*) FROM TableName WHERE WhereStmts<BR><BR>hth
 
Back
Top