Connection Property

Microsoft Office InfoPath

Sets or retrieves the connection string used for an ADOAdapter object.

expression.Connection

expression    Required. An expression that returns a reference to the ADOAdapter object.

Security Level

2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Remarks

The Connection property of the ADOAdapter object contains the connection string that is used by the ADO data adapter to connect to an ActiveX Data Objects/OLEDB external data source.

Note  The ADOAdapter object is limited to work only with Microsoft SQL Server and Microsoft Access databases.

Example

In the following example, the Connection property of the ADOAdapter object is used to display the connection string of the ADO data adapter in a message box:

var objADOAdapter;

objADOAdapter = XDocument.DataObjects("CityList").QueryAdapter;
XDocument.UI.Alert("Connection string: " + objADOAdapter.Connection);