Record Count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Thanks
Kulwinder
 
Kulwinder 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?

Thanks,
Kulwinder

DataSet.Tables(0).Rows.Count
 
What DB are you using? If SQL Server, are you using stored procedures or
dynamic SQL? Are you using ADO.NET? Help us help you: tell us more about
what you are trying to accomplish.



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?
 
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?
 
Hi

I'm using SQL Server and Data Reader to get the record. IF I can't do the record count while i'm using data reader, how can i count the no. of search results??

Please help... Give me a nice example

TIA
Kulwinde
 
You might want to re-read my message. I told you how to do it in the
message:

" The best way with a DataReader is to count as you loop through the
records. "

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Kulwinder Sayal said:
Hi,

I'm using SQL Server and Data Reader to get the record. IF I can't do the
record count while i'm using data reader, how can i count the no. of search
results???
 
Back
Top