SqlConnectionStringBuilder.MultipleActiveResultSets 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
如果为 true,应用程序可以维护多个活动结果集(MARS)。 如果为 false,应用程序必须处理或取消一个批处理中的所有结果集,然后才能在该连接上执行任何其他批处理。
有关详细信息,请参阅多个活动结果集(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”键。