Question on datareader and connection

  • Thread starter Thread starter Kalim Julia
  • Start date Start date
K

Kalim Julia

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

Is it possible to duplicate / clone connection ?
 
Kalim Julia,

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

Kerry Moorman
 
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]
 
There is also MARS

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

Greg

m.posseth said:
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/d...-us/cpguide/html/cpcontheadonetdatareader.asp


regards

Michel Posseth [MCP]


Kalim Julia said:
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?
 
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 said:
There is also MARS

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

Greg

m.posseth said:
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/d...-us/cpguide/html/cpcontheadonetdatareader.asp


regards

Michel Posseth [MCP]


Kalim Julia said:
Is it possible to open more than 1 datareader / dataadapter on one
connection ?

Is it possible to duplicate / clone connection ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top