473,842 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on datareader and connection

Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?
Nov 23 '05 #1
6 1944
Hi,

Yes. Here are some examples

http://www.vb-tips.com/default.aspx?...7-7bc3068aca2c

http://www.vb-tips.com/default.aspx?...e-e8335682ad3a

Ken
-------------------
"Kalim Julia" <ka*********@gm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?

Nov 23 '05 #2
Kalim Julia,

At least thru VS2003, you can have only 1 datareader per connection.

Kerry Moorman
"Kalim Julia" wrote:
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?

Nov 23 '05 #3
No ( .NET 2003 ) for 2005 is am not sure :-|

that is why it is verry important to close the datareader object if you are
ready with it to make the connection availlable again

in fact you can`t issue anny other commands on a connection while a
datareader object is active on that connection the only command you can
perform on a connection actively serving a datareader is the Close method
Is it possible to duplicate / clone connection ? Yes

regrds

Michel Posseth [MCP]

"Kalim Julia" <ka*********@gm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?

Nov 23 '05 #4
i have checked the 2005 reference and did not found other info , so it seems
that the below info is also valid for 2005
http://msdn.microsoft.com/library/de...datareader.asp
regards

Michel Posseth [MCP]
"Kalim Julia" <ka*********@gm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?

Nov 23 '05 #5
There is also MARS

http://msdn2.microsoft.com/en-us/library/ms131686.aspx

Greg

"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:en******** ******@tk2msftn gp13.phx.gbl...
i have checked the 2005 reference and did not found other info , so it
seems that the below info is also valid for 2005
http://msdn.microsoft.com/library/de...datareader.asp
regards

Michel Posseth [MCP]
"Kalim Julia" <ka*********@gm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?


Nov 23 '05 #6
Yep good one ,

simular thing is also possible with SQL 2000 ( multiple resultsets ) by
just writing stored procedures and seperating the sql with a ; now with the
datareader you can use next result to get the folowing resultset

However still....... executing multiple data readers on one connection is
not possible why would someone use a datareader instead of a dataset /
datatable ? well the speed ...as a datareader is much faster if you are
only retrieving data for display purposes .

So the answer is NO you can`t use multiple data readers on a connection ,
however there are workarounds

1. go to a disconected architecture ( much slower )
2. create the datareader`s on there own connection object ( requires some
extra coding from your side )
3. use multiple resultsets
etc etc

regards

Michel Posseth [MCP]



"Greg Burns" <bl*******@news groups.nospam> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
There is also MARS

http://msdn2.microsoft.com/en-us/library/ms131686.aspx

Greg

"m.posseth" <mi*****@nohaus ystems.nl> wrote in message
news:en******** ******@tk2msftn gp13.phx.gbl...
i have checked the 2005 reference and did not found other info , so it
seems that the below info is also valid for 2005
http://msdn.microsoft.com/library/de...datareader.asp
regards

Michel Posseth [MCP]
"Kalim Julia" <ka*********@gm ail.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?



Nov 23 '05 #7

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

Similar topics

6
363
by: Yasutaka Ito | last post by:
Hi, My friend had a little confusion about the working of DataReader after reading an article from MSDN. Following is a message from him... <!-- Message starts --> I was going thru DataReader in ADO.NET in MSDN and there is a confusion regarding the buffering of data in case of DATAREADER. The link for MSDN JAN 2004 is -
6
750
by: Ravi | last post by:
Hi, I am not able to understand why a datareader needs a connection to the DB all the time. Here is what I tried. Sqlcommand cmd = ("select * from table1",con) // where con is the connection object 1. DataReader dr = cmd.executereader(); 2.while(dr.read()) { // do something //} I have a break point in line 2. when i run my application and once it hits the break point (i.e line 2) I opened query analyzer and deleted all the rows in...
4
3061
by: Maziar Aflatoun | last post by:
Hi everyone, I am working on the 'Delete' section of my program. What I need to do is query my database and for every ID that it finds I want to remove a file+ID.jpg from my file folder and update another table with that information. However, I'm getting the following error message. There is already an open DataReader associated with this Connection which must be closed first. Description: An unhandled exception occurred during the...
4
7622
by: James Radke | last post by:
Hello, I am looking for guidance on best practices to incorporate effective and complete error handling in an application written in VB.NET. If I have the following function in a class module (note that this class module represents the business layer of code NOT the gui layer): Public Function Test(ByVal Parm1 As Integer, ByVal Parm2 As Integer) As SqlDataReader ' Declare the SQL data layer class Dim oSQL As New...
17
2389
by: Alan Silver | last post by:
Hello, I have a generic method in a utility class that grabs an sqldatareader and returns it. Due to the fact that (AFAIK), you can't close the database connection before you've read the data, this method doesn't close it, it just returns the datareader. The calling code uses the datareader and then just lets it drop out of scope, to be picked up by the garbage collector. Is this a problem? A friend of mine suggested to me that not...
7
2913
by: Diffident | last post by:
Hello All, I would like to use DataReader based accessing in my Data Access Layer (DAL). What is considered to be a best practice while returning from a DAL method that executes a query and returns N rows. DataReader object? Collection object? DataTable object? Returning a DataReader object is not a good practice...right? Thnks for all your suggestions!!
20
7222
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I get the error "There is already an open DataReader associated with this Connection which must be closed first." How can I fix this error ? For each DataReader, do I want to open and close the connection (in this case adoCon) to avoid this error ?...
10
6116
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the code below which when executed generates the following error message: 'There is already an open datareader with this command which must be closed first' Private Sub MainMenu_Load(ByVal sender As System.Object, ByVal e As
3
3387
by: Johnny Jörgensen | last post by:
I've got an error that I simply cannot locate: I've got a form in which I use a datareader object to read information from a db. After the read, I close the reader and I dispose of both the reader and the command object (but don't close the connection which is public in the solution). The first time i open my form from a parent form, there is no problem. Everything works fine. I then close down my form, and I dispose of the form.
0
9872
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
9715
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9453
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
7858
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
7038
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();...
0
5696
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4089
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.