DBConnection Class

DBConnection class

Specifies all properties associated with an ODBC or OLE DB external data connection.


type DBConnection struct  {
	ptr unsafe.Pointer
}

Constructors

MethodDescription
NewDBConnectionConstructs from a parent object.

Methods

MethodDescription
IsNullChecks whether the implementation object is nullptr.
GetClassTypeGets the type of this object.
GetConnectionStringThe connection information string is used to make contact with an OLE DB or ODBC data source.
SetConnectionStringThe connection information string is used to make contact with an OLE DB or ODBC data source.
GetPowerQueryFormulaGets the definition of power query formula.
GetCommandTypeSpecifies the OLE DB command type.1. Query specifies a cube name2. Query specifies a SQL statement3. Query specifies a table name4. Query specifies that default information has been given, and it is up to the provider how to interpret.5. Query is against a web based List Data Provider.
SetCommandTypeSpecifies the OLE DB command type.1. Query specifies a cube name2. Query specifies a SQL statement3. Query specifies a table name4. Query specifies that default information has been given, and it is up to the provider how to interpret.5. Query is against a web based List Data Provider.
GetCommandThe string containing the database command to pass to the data provider API that willinteract with the external source in order to retrieve data
SetCommandThe string containing the database command to pass to the data provider API that willinteract with the external source in order to retrieve data
GetSecondCommandSpecifies a second command text string that is persisted when PivotTable server-basedpage fields are in use.For ODBC connections, serverCommand is usually a broader query than command (noWHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand),parameter UI can be populated and parameterized queries can be constructed
SetSecondCommandSpecifies a second command text string that is persisted when PivotTable server-basedpage fields are in use.For ODBC connections, serverCommand is usually a broader query than command (noWHERE clause is present in the former). Based on these 2 commands(Command and ServerCommand),parameter UI can be populated and parameterized queries can be constructed
GetIdGets the id of the connection.
GetSourceTypeGets or Sets the external connection DataSource type.
SetSourceTypeGets or Sets the external connection DataSource type.
GetSSOIdIdentifier for Single Sign On (SSO) used for authentication between an intermediatespreadsheetML server and the external data source.
SetSSOIdIdentifier for Single Sign On (SSO) used for authentication between an intermediatespreadsheetML server and the external data source.
GetSavePasswordTrue if the password is to be saved as part of the connection string; otherwise, False.
SetSavePasswordTrue if the password is to be saved as part of the connection string; otherwise, False.
GetSaveDataTrue if the external data fetched over the connection to populate a table is to be savedwith the workbook; otherwise, false.
SetSaveDataTrue if the external data fetched over the connection to populate a table is to be savedwith the workbook; otherwise, false.
GetRefreshOnLoadTrue if this connection should be refreshed when opening the file; otherwise, false.
SetRefreshOnLoadTrue if this connection should be refreshed when opening the file; otherwise, false.
GetReconnectionMethodTypeSpecifies what the spreadsheet application should do when a connection fails.The default value is ReConnectionMethodType.Required.
SetReconnectionMethodTypeSpecifies what the spreadsheet application should do when a connection fails.The default value is ReConnectionMethodType.Required.
GetOnlyUseConnectionFileIndicates whether the spreadsheet application should always and only use theconnection information in the external connection file indicated by the odcFile attributewhen the connection is refreshed. If false, then the spreadsheet applicationshould follow the procedure indicated by the reconnectionMethod attribute
SetOnlyUseConnectionFileIndicates whether the spreadsheet application should always and only use theconnection information in the external connection file indicated by the odcFile attributewhen the connection is refreshed. If false, then the spreadsheet applicationshould follow the procedure indicated by the reconnectionMethod attribute
GetOdcFileSpecifies the full path to external connection file from which this connection wascreated. If a connection fails during an attempt to refresh data, and reconnectionMethod=1,then the spreadsheet application will try again using information from the external connection fileinstead of the connection object embedded within the workbook.
SetOdcFileSpecifies the full path to external connection file from which this connection wascreated. If a connection fails during an attempt to refresh data, and reconnectionMethod=1,then the spreadsheet application will try again using information from the external connection fileinstead of the connection object embedded within the workbook.
GetSourceFileUsed when the external data source is file-based.When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May beexpressed in URI or system-specific file path notation.
SetSourceFileUsed when the external data source is file-based.When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file. May beexpressed in URI or system-specific file path notation.
IsNewTrue if the connection has not been refreshed for the first time; otherwise, false.This state can happen when the user saves the file before a query has finished returning.
SetIsNewTrue if the connection has not been refreshed for the first time; otherwise, false.This state can happen when the user saves the file before a query has finished returning.
GetNameSpecifies the name of the connection. Each connection must have a unique name.
SetNameSpecifies the name of the connection. Each connection must have a unique name.
GetKeepAliveTrue when the spreadsheet application should make efforts to keep the connectionopen. When false, the application should close the connection after retrieving theinformation.
SetKeepAliveTrue when the spreadsheet application should make efforts to keep the connectionopen. When false, the application should close the connection after retrieving theinformation.
GetRefreshInternalSpecifies the number of minutes between automatic refreshes of the connection.
SetRefreshInternalSpecifies the number of minutes between automatic refreshes of the connection.
GetConnectionDescriptionSpecifies the user description for this connection
SetConnectionDescriptionSpecifies the user description for this connection
IsDeletedIndicates whether the associated workbook connection has been deleted. true if theconnection has been deleted; otherwise, false.
SetIsDeletedIndicates whether the associated workbook connection has been deleted. true if theconnection has been deleted; otherwise, false.
GetCredentialsMethodTypeSpecifies the authentication method to be used when establishing (or re-establishing) the connection.
SetCredentialsMethodTypeSpecifies the authentication method to be used when establishing (or re-establishing) the connection.
GetBackgroundRefreshIndicates whether the connection can be refreshed in the background (asynchronously).true if preferred usage of the connection is to refresh asynchronously in the background;false if preferred usage of the connection is to refresh synchronously in the foreground.
SetBackgroundRefreshIndicates whether the connection can be refreshed in the background (asynchronously).true if preferred usage of the connection is to refresh asynchronously in the background;false if preferred usage of the connection is to refresh synchronously in the foreground.
GetParametersGets for an ODBC or web query.
GetConnectionFileGets the connection file.