SqlCeDataReader

  • Thread starter Thread starter David
  • Start date Start date
Since DataReader is a forward only sequential reader you can't determine the
number of results until you have read through them all (when Read returns
false).
Instead you can issue a "select count(fieldname) from tablename where..."
query which can be used to get the number of items matching your query, call
the ExecuteScalar method to return this single result.
You can alternatively use a DataAdapter which will fill a DataSet with the
results and you can query the number of rows contained, but for a large
quantity of records this can be resource intensive.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com

Do have an opinion on the effectiveness of Microsoft Windows Mobile and
Embedded newsgroups? Let us know!
https://www.windowsembeddedeval.com/community/newsgroups
 
Back
Top