Bagikan melalui


SqlConnectionStringBuilder.MultipleActiveResultSets Properti

Definisi

Jika true, aplikasi dapat mempertahankan beberapa tataan hasil aktif (MARS). Ketika false, aplikasi harus memproses atau membatalkan semua tataan hasil dari satu batch sebelum dapat menjalankan batch lain pada koneksi tersebut.

Untuk informasi selengkapnya, lihat Beberapa Kumpulan Hasil Aktif (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

Nilai Properti

Nilai MultipleActiveResultSets properti , atau false jika tidak ada yang disediakan.

Contoh

Contoh berikut secara eksplisit mengaktifkan fitur Beberapa Kumpulan Hasil Aktif.

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

Keterangan

Properti ini sesuai dengan kunci "MultipleActiveResultSets" dalam string koneksi.

Berlaku untuk

Lihat juga