473,387 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Record Count

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
Nov 18 '05 #1
12 5891
Kulwinder Sayal wrote:
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
Nov 18 '05 #2
Kulwinder Sayal wrote:
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
Nov 18 '05 #3
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" <an*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
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

Nov 18 '05 #4
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" <an*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
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

Nov 18 '05 #5
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" <an*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
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

Nov 18 '05 #6
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" <an*******@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com...
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

Nov 18 '05 #7
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
Nov 18 '05 #8
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
Nov 18 '05 #9
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" <an*******@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
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,
Kulwinder

Nov 18 '05 #10
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" <an*******@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
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,
Kulwinder

Nov 18 '05 #11
The following page on the MSDN Library contains an example:

http://msdn.microsoft.com/library/de...datareader.asp

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

"Kulwinder Sayal" <an*******@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
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,
Kulwinder

Nov 18 '05 #12
The following page on the MSDN Library contains an example:

http://msdn.microsoft.com/library/de...datareader.asp

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

"Kulwinder Sayal" <an*******@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
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,
Kulwinder

Nov 18 '05 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr...
3
by: thomasp | last post by:
I am trying to get a record count of a PHP query on a MS Acess database using ODBC with a DSN for MS ACCESS connection. I got this code from the PHP manual user notes. It seems to return the...
1
by: Justin Koivisto | last post by:
I am trying to create a report that displays a name of an advertising source and count of the number of times it was hit between certain date ranges. The data is split between two different...
6
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a...
1
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the...
1
by: darrel | last post by:
I'm trying to whip up a fancy repeater control that will put records into a two-column table for me. This is how I envision it working: itemtemplate if record count = odd then write out the...
7
by: Mike | last post by:
I have a form where I have turned off the default navigation buttons. I then created my own. This works fine. The only questions that I have is on the default navigation buttons it shows total...
4
by: Peter W Johnson | last post by:
Hi guys, I have a problem with a datagrid record count. Here is the code:- <snip> Public Class frmMerchantDeposit Inherits System.Windows.Forms.Form Dim myconnection As New...
2
by: Catch_22 | last post by:
Hi, I have a stored procedure that has to extract the child records for particular parent records. The issue is that in some cases I do not want to extract all the child records only a...
4
by: Phil Stanton | last post by:
Sorry to repost, but am having another look at deleting a record. I have a form (Member) and have removed all the event procedures associated with the Form (OnCurrent, OnDelete, OnActivate etc)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.