共用方式為


Restrictions on Regular and Context Connections

更新: 2005 年 12 月 5 日

This topic discusses the restrictions associated with code executing in the Microsoft SQL Server process through context and regular connections.

Restrictions on Context Connections

When developing your application, take into account the following restrictions that apply to context connections:

  • You can have only one context connection open at a given time for a given connection. If you have multiple statements running concurrently in separate connections, each one of them can get their own context connection. The restriction does not affect concurrent requests from different connections; it only affects a given request on a given connection.
  • Multiple Active Result Sets (MARS) is not supported in a context connection.
  • The SqlBulkCopy class does not operate in a context connection.
  • Update batching in a context connection is not supported
  • SqlNotificationRequest cannot be used with commands that execute against a context connection.
  • Canceling commands that are running against the context connection is not supported. The SqlCommand.Cancel method silently ignores the request.
  • No other connection string keywords can be used when you use "context connection=true".
  • The SqlConnection.DataSource property returns null if the connection string for the SqlConnection is "context connection=true", instead of the name of the instance of SQL Server.
  • Setting the SqlCommand.CommandTimeout property has no effect when the command is executed against a context connection.

Restrictions on Regular Connections

When developing your application, take into account the following restrictions that apply to regular connections:

  • Asynchronous command execution against internal servers is not supported. Including "async=true" in the connection string of a command, and then executing the command, results in System.NotSupportedException being thrown. This message appears: "Asynchronous processing is not supported when running inside the SQL Server process."
  • SqlDependency object is not supported.

Change History

Release History

2006 年 7 月 17 日

Changed content:
  • Added comment about the SqlCommand.TimeOut property and the context connection.

2005 年 12 月 5 日

Changed content:
  • Added comment about the SqlConnection.DataSource property returning Null for context connections.

請參閱

概念

The Context Connection

說明及資訊

取得 SQL Server 2005 協助