Actually, ASP has no methods for connecting with a database. You're
referring to ADO (ActiveX Data Objects). There are more than one set of
classes for working with databases in the .Net platform. Most likely, you
are tlaking about either a DataReader, DataSet or a DataTable. A DataReader
is a forward-only, read-only cursor, from which you can not get a count of
records until it is closed. The best way with a DataReader is to count as
you loop through the records. A DataSet is not a container for database
results per se, but a container for DataTables. A DataTable is a complete
RecordSet fetched from a data source. It has a Rows Collection of all the
rows of data in the Result Set. You can get a count by checking the Count
property of the Rows Collection. Example:
int intCt = MyDataTable.Rows.Count;
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
Kulwinder Sayal said:
Hi,
In ASP it was so simple to get the no. of records using RecordCount. Can
anyone help me how to write the no. of records my sqlquery has searched?