AppInstance.TryGetAppDatabaseConnectionDirect method (ClientRuntimeContext, SqlConnection, Boolean)
Retrieves a connection to the app database.
Namespace: Microsoft.SharePoint.Client
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Syntax
'Declaration
Public Shared Function TryGetAppDatabaseConnectionDirect ( _
context As ClientRuntimeContext, _
<OutAttribute> ByRef connection As SqlConnection, _
<OutAttribute> ByRef isReadOnly As Boolean _
) As Boolean
'Usage
Dim context As ClientRuntimeContext
Dim connection As SqlConnection
Dim isReadOnly As Boolean
Dim returnValue As Boolean
returnValue = AppInstance.TryGetAppDatabaseConnectionDirect(context, _
connection, isReadOnly)
public static bool TryGetAppDatabaseConnectionDirect(
ClientRuntimeContext context,
out SqlConnection connection,
out bool isReadOnly
)
Parameters
context
Type: Microsoft.SharePoint.Client.ClientRuntimeContextClient context to operate with.
connection
Type: System.Data.SqlClient.SqlConnectionConnection object if one could be opened, otherwise a null reference (Nothing in Visual Basic).
isReadOnly
Type: System.BooleanIndicates whether the connection can be used to write data. true if the connection can be used to write data, otherwise false.
Return value
Type: System.Boolean
true if a connection can be opened, otherwise false.
Remarks
This method only returns connections to the database that are auto deployed. This method may call ExecuteQuery function on the given context.