SqlConnectionStringBuilder.MultipleActiveResultSets Property

Definition

如果为 true,则应用程序可以维护多个活动结果集 (MARS)。When true, an application can maintain multiple active result sets (MARS). 如果为 false,则应用程序必须先处理或取消某一批中的所有结果集,才可以在该连接上执行任何其他批次。When false, an application must process or cancel all result sets from one batch before it can execute any other batch on that connection.

有关详细信息,请参阅多个活动结果集 (MARS)For more information, see Multiple Active Result Sets (MARS).

public:
 property bool MultipleActiveResultSets { bool get(); void set(bool value); };
public bool MultipleActiveResultSets { get; set; }
member this.MultipleActiveResultSets : bool with get, set
Public Property MultipleActiveResultSets As Boolean

Property Value

Boolean

MultipleActiveResultSets 属性的值,或者,如果未提供任何值,则为 falseThe value of the MultipleActiveResultSets property, or false if none has been supplied.

Examples

下面的示例显式禁用多个活动的结果集功能。The following example explicitly disables the Multiple Active Result Sets feature.

using System.Data.SqlClient;

class Program
{
    static void Main()
    {
        SqlConnectionStringBuilder builder = 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(builder.ConnectionString);
        Console.WriteLine();

        Console.WriteLine("Press Enter to continue.");
        Console.ReadLine();
    }
}
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(builder.ConnectionString)
        Console.WriteLine()

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

Remarks

此属性与连接字符串内的“MultipleActiveResultSets”键相对应。This property corresponds to the "MultipleActiveResultSets" key within the connection string.

Applies to

See also