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

IDataReader on closed connection

As far as I understand, IDataReader, based on command recieves isClosed
property when the connection closes.
How to prevent it?
Nov 15 '05 #1
5 1954
If you are looking for a way to use a IDataReader object after the
underlying connection is closed, I don't believe you'll find a way to
do that. It is desgined to be associated with a live connection.

If you want to work with the data after a connection is closed, look
at the DataSet class.

--
Scott
http://www.OdeToCode.com

On Wed, 14 Jan 2004 18:33:52 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
As far as I understand, IDataReader, based on command recieves isClosed
property when the connection closes.
How to prevent it?


Nov 15 '05 #2
I do not want to use dataset class due its overhead
are there any "disconnected" readers?
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:4k********************************@4ax.com...
If you are looking for a way to use a IDataReader object after the
underlying connection is closed, I don't believe you'll find a way to
do that. It is desgined to be associated with a live connection.

If you want to work with the data after a connection is closed, look
at the DataSet class.

--
Scott
http://www.OdeToCode.com

On Wed, 14 Jan 2004 18:33:52 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
As far as I understand, IDataReader, based on command recieves isClosed
property when the connection closes.
How to prevent it?

Nov 15 '05 #3
Tamir,

The data set is the only way you are going to be able to do this. You
have to connect at some point to get the data, and a data adapter actually
gets a data reader to populate a data set. If you did have a "disconnected"
reader of some sort, then it would just be an iteration over a data set
anyways (or some other storage in memory).

If you want to work with the data in a disconnected way, use the
dataset.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tamir Khason" <ta**********@tcon-NOSPAM.co.il> wrote in message
news:uc**************@TK2MSFTNGP09.phx.gbl...
I do not want to use dataset class due its overhead
are there any "disconnected" readers?
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:4k********************************@4ax.com...
If you are looking for a way to use a IDataReader object after the
underlying connection is closed, I don't believe you'll find a way to
do that. It is desgined to be associated with a live connection.

If you want to work with the data after a connection is closed, look
at the DataSet class.

--
Scott
http://www.OdeToCode.com

On Wed, 14 Jan 2004 18:33:52 +0200, "Tamir Khason"
<ta**********@tcon-NOSPAM.co.il> wrote:
As far as I understand, IDataReader, based on command recieves isClosed
property when the connection closes.
How to prevent it?


Nov 15 '05 #4

Hi Tamir,

Thanks for posting in this group.
Based on my understanding, you want to use a disconnected reader for
database.
Because you have disconnected the databse, all the data you want to read
should be stored in the memory. In ADO, the in-memory representation of
data is the recordset. In ADO.NET, it is the dataset.
For performance, if you do not want to retrieve the whole table data into
memory, I think you can use SQL statement to get the data subset you
wanted.
The article below compares the dataset and the recordset:
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconadopreviousversionsofado.asp

All in all, in ADO.net the dataset is the only way for disconnected data
reading.
If you still have any conern, please feel free to tell me. I will work with
you.

Have a nice day!!

Best regards,
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.

Nov 15 '05 #5
Yes, I understand it.
Just override it by creation custom reader. This works OK and without the
overhead of dataset
""Jeffrey Tan[MSFT]"" <v-*****@online.microsoft.com> wrote in message
news:ir**************@cpmsftngxa07.phx.gbl...

Hi Tamir,

Does my reply make sense to you
If you still have any concern, please feel free to tell me. I will work
with you.

Best regards,
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.

Nov 15 '05 #6

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

Similar topics

5
by: Gelios | last post by:
Hello All! I am going to crazy and feeling myself so stupid but I don't understand such behaviour. I have code: public int getNextAgentId() { Int32 agent_id = 0; IDataReader dr =...
3
by: Lubomir | last post by:
Hi, I have a class A with a public method GetReader: public OleDbDataReader GetReader() { SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings); SqlCommand...
26
by: Rajeev Tipnis | last post by:
http://support.microsoft.com/default.aspx?scid=kb;en- us;819450 Questions: 1) Is this patch (fix) applicable to the .NET 1.1 Framework as well? That is, if we have Framework 1.1 (On...
4
by: Mahesh Kumar.R | last post by:
What is the difference between SqlDataReader and IDataReader ...? kindly with small example... Mahesh~
2
by: יוני גולדברג | last post by:
Hi, In few places within my code the business object pass IDataReader to the GUI. Suddenly i noticed that nowhere in the code the IDataReader is being closed. Does the data binding operation...
2
by: Larry R | last post by:
Whenever I try the following, the reader that is returned is always closed. What am I missing ? When I look at the reader in the ExecuteReader, it is fine. THen it gets closed on the returm. ...
6
by: billiejoex | last post by:
Hi there. I'm setting up test suite for a project of mine. situations, if the socket is closed on the other end or not. I noticed that I can "detect" such state if a call to socket.read() returns...
4
by: Sin Jeong-hun | last post by:
I don't get the message so it's hard to debug that, but some of my clients report that they get "The underlying connection was closed unexpectedly" exception. According to this site (http://...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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.