This documentation is archived and is not being maintained.

SqlContext::IsAvailable Property

Specifies whether the calling code is running within SQL Server, and if the context connection can be accessed.

Namespace:  Microsoft.SqlServer.Server
Assembly:  System.Data (in System.Data.dll)

public:
static property bool IsAvailable {
	bool get ();
}

Property Value

Type: System::Boolean
True if the context connection is available and the other SqlContext members can be accessed.

If this property returns false, all the other SqlContext members throw an InvalidOperationException if used.

If this property returns false, any attempt to open a connection object that has "context connection=true" in the connection string fails.

This property is read-only.

When using ADO.NET for data-access, if a piece of code may run both inside SQL Server (using common language runtime integration) and outside SQL Server, this property can be used to check whether the context connection is available.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: