Groups | Blog | Home
all groups > dotnet ado.net > july 2007 >

dotnet ado.net : More than one Data reader in a single connection



Ziangi Jones
7/7/2007 9:42:01 AM
Hi All,

Is it possible to have more than one data reader in a single connection
(MSDN documentation dated July 2002 says that to have more than one data
reader, there should be more than one connection, one for each data reader.)
http://msdn2.microsoft.com/en-us/library/ms971481.aspx

has the situation changed in .NET 2.0 ?
--
William (Bill) Vaughn
7/7/2007 9:54:36 AM
Under certain circumstances you CAN have more than one operation executed
against a single SQL Server connection--if you use MARS. Multiple Active
Resultsets is enabled in ADO.NET 2.0. While I don't endorse it (as
connections are really pretty cheap with SQL Server) it can be done.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

[quoted text, click to view]

Kerry Moorman
7/7/2007 9:58:00 AM
Ziangi Jones,

ADO.Net 2.0 introduced a new feature called Multiple Active Result Sets
(MARS). This feature allows multiple open data readers on the same connection.

However, MARS has all sorts of ramifications that you need to understand
really well before using it.

Personally, I would use multiple connections.

Kerry Moorman


[quoted text, click to view]
AddThis Social Bookmark Button