Listing 12 - 8 "Mars"
Ok Listing 12-8 Exposes a MARS capability.
I don't want any misunderstandings here.
I'm not Sure about you folks, but I had augly troubles with this one.
As I realised from the CodeGuru WebSite, The Mars Capability begins only from the SqlServer 2005 versions.
Now Let me explain a few things.
You will probably receive some ugly error that says:
there's an already open SqlDatareader associated with this Command which must be closed first.
Basically The autors did not speak about the ON/OFF capability of the MARS feature. which anables you to use a Multi SqlDataReaders.
Yes, this capability should work once you Import a namespace called
System.Data.SqlClient. But guess what? It has not worked for me!
Why I have no idea???
anyways you can switch it On/Off by adding a simple attribute to the Connectionstring in your WEb.config file:
True for ON, and False for OFF :)
//----------------Web.Config File----------------------
<connectionStrings>
<add name="DSN_NorthWind" connectionString="Data Source=user;Initial Catalog=Northwind;Integrated Security=True; MultipleActiveResultSets =True"
providerName="System.Data.SqlClient" />
//-----------------------------------------------------
remember Mars works only with the 2005 versions.
|