473,320 Members | 1,825 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,320 software developers and data experts.

OleDbDataReader Question

Hello,

How do I get the number of row retrieved on a SELECT
query when using OleDbDataReader?

I am using Framework 1.0.
Nov 15 '05 #1
3 8105
Hello,

I was orginally using the OleDbDataAdapter and then using
the Fill method which provided me with the row count. The
problem is that the DataSet uses DataTable underneath the
cover which is not a lightweight object, we have a
performance issue which is that the GC is constantly been
run due to the Fill command (main cause is the dataset).
We want to use the OleDbDataReader which is light weight
but the only thing we cannot get out of it is the number
of rows. I've noticed through the watch window it holds
the number of rows in a variable called
rowhandleNumberRows but due to it protection level it
cannot be access, this to be means a floor with Microsoft
as they already know the number of rows.
-----Original Message-----
With Framework 1.0 no way to get it (Framework 1.1 has HasRows property butwon't tell the row number either) on beforehand. Bullet- proof way is to runa separate query that returns the count or use DataSet.

For what do you need the count? Perhaps there would be other approach tosolve your issue?

--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

AspInsiders Member, www.aspinsiders.com
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com
"Buddy" <Bu***@Onlinehome.com> wrote in message
news:02****************************@phx.gbl...
Hello,

How do I get the number of row retrieved on a SELECT
query when using OleDbDataReader?

I am using Framework 1.0.

.

Nov 15 '05 #2
use scalar to retreive count
"Buddy" <Bu***@Onlinehome.com> wrote in message
news:08****************************@phx.gbl...
Hello,

I was orginally using the OleDbDataAdapter and then using
the Fill method which provided me with the row count. The
problem is that the DataSet uses DataTable underneath the
cover which is not a lightweight object, we have a
performance issue which is that the GC is constantly been
run due to the Fill command (main cause is the dataset).
We want to use the OleDbDataReader which is light weight
but the only thing we cannot get out of it is the number
of rows. I've noticed through the watch window it holds
the number of rows in a variable called
rowhandleNumberRows but due to it protection level it
cannot be access, this to be means a floor with Microsoft
as they already know the number of rows.
-----Original Message-----
With Framework 1.0 no way to get it (Framework 1.1 has

HasRows property but
won't tell the row number either) on beforehand. Bullet-

proof way is to run
a separate query that returns the count or use DataSet.

For what do you need the count? Perhaps there would be

other approach to
solve your issue?

--
Teemu Keiski
MCP, Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

AspInsiders Member, www.aspinsiders.com
ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com
"Buddy" <Bu***@Onlinehome.com> wrote in message
news:02****************************@phx.gbl...
Hello,

How do I get the number of row retrieved on a SELECT
query when using OleDbDataReader?

I am using Framework 1.0.

.

Nov 15 '05 #3

Hi Budy,

You can visit the link below to get some help:
http://support.microsoft.com/default...b;en-us;308352
If you still have any concerns, please feel free to let me know.

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "Buddy" <Bu***@Onlinehome.com>
| Sender: "Buddy" <Bu***@Onlinehome.com>
| References: <02****************************@phx.gbl>
<OD*************@TK2MSFTNGP10.phx.gbl>
<08****************************@phx.gbl> <bh**********@ls219.htnet.hr>
| Subject: Re: OleDbDataReader Question
| Date: Sat, 16 Aug 2003 23:39:00 -0700
| Lines: 75
| Message-ID: <05****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcNkij438AdfHmReR6a8xT2kzl2hcg==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:176965
| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I cannot use the ExecuteScalar method for two reasons,
| one that I need all the data back, and second that I
| cannot run the query twice as there are possible INSERT,
| UPDATE, DELETE queries taking place.
|
| Any other ideas?
|
| >-----Original Message-----
| >use scalar to retreive count
| >"Buddy" <Bu***@Onlinehome.com> wrote in message
| >news:08****************************@phx.gbl...
| >> Hello,
| >>
| >> I was orginally using the OleDbDataAdapter and then
| using
| >> the Fill method which provided me with the row count.
| The
| >> problem is that the DataSet uses DataTable underneath
| the
| >> cover which is not a lightweight object, we have a
| >> performance issue which is that the GC is constantly
| been
| >> run due to the Fill command (main cause is the
| dataset).
| >> We want to use the OleDbDataReader which is light
| weight
| >> but the only thing we cannot get out of it is the
| number
| >> of rows. I've noticed through the watch window it holds
| >> the number of rows in a variable called
| >> rowhandleNumberRows but due to it protection level it
| >> cannot be access, this to be means a floor with
| Microsoft
| >> as they already know the number of rows.
| >>
| >> >-----Original Message-----
| >> >With Framework 1.0 no way to get it (Framework 1.1 has
| >> HasRows property but
| >> >won't tell the row number either) on beforehand.
| Bullet-
| >> proof way is to run
| >> >a separate query that returns the count or use
| DataSet.
| >> >
| >> >For what do you need the count? Perhaps there would be
| >> other approach to
| >> >solve your issue?
| >> >
| >> >--
| >> >Teemu Keiski
| >> >MCP, Designer/Developer
| >> >Mansoft tietotekniikka Oy
| >> >http://www.mansoft.fi
| >> >
| >> >AspInsiders Member, www.aspinsiders.com
| >> >ASP.NET Forums Moderator, www.asp.net
| >> >AspAlliance Columnist, www.aspalliance.com
| >> >
| >> >
| >> >"Buddy" <Bu***@Onlinehome.com> wrote in message
| >> >news:02****************************@phx.gbl...
| >> >> Hello,
| >> >>
| >> >> How do I get the number of row retrieved on a SELECT
| >> >> query when using OleDbDataReader?
| >> >>
| >> >> I am using Framework 1.0.
| >> >
| >> >
| >> >.
| >> >
| >
| >
| >.
| >
|

Nov 15 '05 #4

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

Similar topics

10
by: Dion Heskett | last post by:
I wish to supply the formating as a parameter, I have tried OleDbDataReader but get a null ref. just can't seem to get this to work. I think this has something to do with ExecuteReader. also...
7
by: Smitty | last post by:
I have a function that imports an Excel file into an Access table using SQL. I then close the OleDataReader and the OleDbConnection, then dispose the OleDbCommand, then OleDbConnection. The calling...
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 =...
0
by: Steve1 via DotNetMonster.com | last post by:
Hi all, I''ve created an OleDbDataReader that will contain the number of records that the used SQL query will return. I'm then using a while loop to loop while the OleDBDataReader object has...
1
by: Keith | last post by:
Hi, if have this method in a cs file that connections to a database and returns a datareader to my web form. public OleDbDataReader GetDataReader(string theSQL) { theConn = new...
1
by: Steven K | last post by:
Hello, I am using the following code which works. My question is does the OleDbDataReader need to be closed and then re-executed for every control? Is there a more effecient way of doing this...
1
by: Rob Richardson | last post by:
Greetings! I have a database created in MS Access that has some fields containing Currency data. Every time I try to use one of the OleDbDataReader's GetXXX() methods to read it, I get an...
3
by: Nexus | last post by:
I'm currently using .NET version 2003. I want to be able to retrieve records. How do I do so using the OleDbDataReader? Can I have some codes as an example?
2
by: Peter | last post by:
Hi, everybody, The codes below run under VS2003 for a long time. I want to upgrade it to VS2005. VS2005 gives me some varning messages such as "Varibles shouldn't be used before being assigned". ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.