I have the following connection string in my code:
SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["RaiseFantasyLeagueConnectionString"].ConnectionString);
My webconfig for this looks like this:
<connectionStrings>
<add name="RaiseFantasyLeagueConnectionString" connectionString="Data Source=MATT-PC\SQLEXPRESS;Initial Catalog=Raise;Integrated Security=True" providerName="System.Data.SqlClient"/>
Can somebody tell me where I can enable MultipleActiveResultSets for my connection?
Multiple Active Result Sets (MARS) is a feature that allows the execution of multiple batches on a single connection. In previous versions, only one batch could be executed at a time against a single connection. Executing multiple batches with MARS does not imply simultaneous execution of operations.
MARS enables the interleaved execution of multiple requests within a single connection. That is, it allows a batch to run, and within its execution, it allows other requests to execute.
App and Application Name are simply a way for somebody debugging SQL Server to know which client is connecting to it. If you had a SQL Server that has several apps that used it, it might be hard to know which one was sending which statements. If each app used a different Application Name it would be very clear.
It is really simple, just add
MultipleActiveResultSets=true;
so change, in your web.config, the connection string in this way:
connectionString="Data Source=MATT-PC\SQLEXPRESS;" +
"Initial Catalog=Raise;Integrated Security=True;" +
"MultipleActiveResultSets=true;"
Try this code
<connectionStrings>
<add name="RaiseFantasyLeagueConnectionString" connectionString="Data Source=MATT-PC\SQLEXPRESS;Initial Catalog=Raise;Integrated Security=True ;MultipleActiveResultSets=True;" providerName="System.Data.SqlClient";/>
Must refer this Msdn article
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With