SqlConnectionStringBuilder.MultipleActiveResultSets プロパティ

定義

true の場合、アプリケーションは複数のアクティブな結果セット (MARS) を保持できます。 false の場合、その接続で他のバッチを実行するには、その前にアプリケーションは 1 つのバッチからのすべての結果セットを処理するか、取り消す必要があります。

詳細については、「 複数のアクティブな結果セット (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

プロパティ値

MultipleActiveResultSets プロパティの値。値が指定されていない場合は false

次の例では、複数のアクティブな結果セット機能を明示的に有効にします。

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

注釈

このプロパティは、接続文字列内の "MultipleActiveResultSets" キーに対応しています。

適用対象

こちらもご覧ください