473,796 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8130
Hello,

I was orginally using the OleDbDataAdapte r 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
rowhandleNumber Rows 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***@Onlineho me.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***@Onlineho me.com> wrote in message
news:08******** *************** *****@phx.gbl.. .
Hello,

I was orginally using the OleDbDataAdapte r 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
rowhandleNumber Rows 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***@Onlineho me.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***@Onlineho me.com>
| Sender: "Buddy" <Bu***@Onlineho me.com>
| References: <02************ *************** *@phx.gbl>
<OD************ *@TK2MSFTNGP10. phx.gbl>
<08************ *************** *@phx.gbl> <bh**********@l s219.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: AcNkij438AdfHmR eR6a8xT2kzl2hcg ==
| Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
| Path: cpmsftngxa06.ph x.gbl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1769 65
| NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
| X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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***@Onlineho me.com> wrote in message
| >news:08******* *************** ******@phx.gbl. ..
| >> Hello,
| >>
| >> I was orginally using the OleDbDataAdapte r 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
| >> rowhandleNumber Rows 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***@Onlineho me.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
5608
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 can't seem to use this as the first pram OleDbDataReader reader = new OleDbDataReader() i.e public static string Read(OleDbDataReader reader, string query, string
7
5389
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 function then attempts a File.Delete (also tried the FileInfo delete) on the Excel file, but gets the message "The process cannot access the file ... because it is being used by another process". I've stepped through the code and it steps...
1
2711
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 = comboBox2.Text; objreturnst.Parameters.Value = comboBox1.Text; oleDbConnection1.Open();
0
1379
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 records. I would like to know does the OleDbDataReader contain the actual information on each record i.e. the fields in the database and their values? Or does the ExecuteReader command only contain the number of records present from the used SQL...
1
1970
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 OleDbConnection(ConnectionString); theConn.Open(); OleDbCommand cmd = new OleDbCommand(theSQL, theConn);
1
272
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 other than using a loop? Thanks in advance, Steven Dim spTermType As OleDb.OleDbDataReader
1
2506
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 invalid cast exception. Is it possible to use the OleDbDataReader to get the value of a currency field in an Access database? If so, how? Rob, who probably shouldn't even ask this question, since the OleDbDataReader is too simplistic. I should...
3
1448
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
1243
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". My question is: Is it necessary to close sDa in my code? '------------------------------------------------------------------------------- Private Function MethodIDExist(ByVal iMethodID As Integer) As Boolean Dim oCmd As New OleDbCommand
0
9684
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10459
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10236
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7552
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.