Specifies whether the calling code is running within SQL Server, and if the context connection can be accessed.
Public Shared ReadOnly Property IsAvailable As Boolean
Dim value As Boolean value = SqlContext.IsAvailable
public static bool IsAvailable { get; }
public: static property bool IsAvailable { bool get (); }
public static function get IsAvailable () : boolean
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.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98