SqlConnectionStringBuilder.MultipleActiveResultSets Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

When true, an application can maintain multiple active result sets (MARS). When false, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.

For more information, see Multiple Active Result Sets (MARS).

Namespace:   System.Data.SqlClient
Assembly:  System.Data (in System.Data.dll)

Public Property MultipleActiveResultSets As Boolean

Property Value

Type: System.Boolean

The value of the MultipleActiveResultSets property, or false if none has been supplied.

This property corresponds to the "MultipleActiveResultSets" key within the connection string.

The following example explicitly disables the Multiple Active Result Sets feature.

Imports System.Data.SqlClient
Module Module1
    Sub Main()
        Dim builder As New SqlConnectionStringBuilder
        builder.DataSource = "(local)"
        builder.IntegratedSecurity = True
        builder.InitialCatalog = "AdventureWorks"

        ' The connection does not allow multiple active result sets
        ' by default, so this line of code explicitly
        ' enables this feature. Note that this feature is 
        ' only available when programming against SQL Server 2005
        ' or later.
        builder.MultipleActiveResultSets = True


        Console.WriteLine("Press Enter to continue.")
    End Sub
End Module

.NET Framework
Available since 2.0
Return to top