473,387 Members | 1,540 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.

HasRows

I have found the HasRows member of the OleDbConnection. This is very nice to
tell me if I have any data coming but what if I want to see how many rows of
data I have. Is there a similar member to Recordcount?

Thanks for your help in advance!!!
Aug 22 '06 #1
1 2347
"Rick" <ri**@di-wave.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
>I have found the HasRows member of the OleDbConnection.
The OleDbConnection object doesn't have a HasRows member:
http://authors.aspalliance.com/aspxt...tionClass.aspx

You're confusing it with the OleDbReader class:
http://msdn2.microsoft.com/en-us/lib...r.hasrows.aspx
This is very nice to tell me if I have any data coming but what if I want
to see how many rows of data I have. Is there a similar member to
Recordcount?
No. If you need to know the actual number of records contained in the
OleDbReader, as opposed to whether there are any records or not, you have
several options:

1) Don't use an OleDbReader - use a DataSet instead, and interrogate the
<DataSet.Tables[0].Rows.Count property.

2) Have your OleDbReader return two Resultsets, the first which contains a
scalar of the number of rows contained in the second. Interrogate the first
one, then invoke the NextResult method to advance to the second:
http://msdn2.microsoft.com/en-us/lib...extresult.aspx

E.g.

SELECT COUNT(*) FROM <Table>
SELECT (*) FROM <Table>

3) Read your OleDbReader object into another object e.g. a generic
collection and then interrogate that, or increment a counter as you are
iterating through it.
Aug 22 '06 #2

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

Similar topics

0
by: James Hokes | last post by:
Hi All, We're using the 1.1. Framework against SQL Server 2000, and are having a strange issue where we don't get errors back from the stored procedure, i.e. the exception never gets thrown. ...
1
by: charliewest | last post by:
Is there a .Net Compact Framework equivalent in the system.data.sqlserverce namespace of the .Net Framework system.data.sqlclient DataReader object's "Has.Rows" method? For example: ...
2
by: gjtired | last post by:
Hi, I can't figure out why my HasRows code is always true. Below is a snippet of my code. sqlConnection1.Open(); //Check that quiz name is not a duplicate during the Create(0)task string...
1
by: Claudia Fong | last post by:
Hi, I'm using the oleDbDataReader HasRows properties to detect wheter my table contains a record with the parameter below: oleDbConnection1.Close(); objreturnst.Parameters.Value =...
1
by: AJ | last post by:
I'm trying to use this property but the compiler doesn't understand HasRows and the documentation says I need 1.1 of the framework and looking in my "add or remove programs" I have the framework...
2
by: Stijn Verrept | last post by:
I am having the same problem as the person in this thread mentions: http://groups.google.be/groups?q=asp+net+empty+datareader+hasrows&hl=nl&...
2
by: TN Bella | last post by:
PLEASE HELP!! I am so far behind....and it doesn't help that I am learning all this stuff. I am using .net framework 1.0 from WebMatrix. These parameters get me all confused...someone please help!...
2
by: Jack Black | last post by:
Hi, all! What is the method for either testing for rows in a recordset or returning the number of rows in a recordset from a populated Adapter or from a DataSet? I know you can use HasRows with...
0
by: ashes | last post by:
Hi, i created a register form on a website. The information from the form has to go in the customer table in a database in MS Access. the information is going into the table perfectly. ...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.