Command Property

Microsoft Office InfoPath

Sets or retrieves the SQL command string text for an ADOAdapter object.

expression.Command

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 Command property of the ADOAdapter object contains the SQL command text that is used by the ADO data adapter to submit data to and retrieve data from 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 Command property of the ADOAdapter object is used to display the SQL command text of the ADO data adapter in a message box:

var objADOAdapter;

objADOAdapter = XDocument.DataObjects("CityList").QueryAdapter;
XDocument.UI.Alert("SQL command text: " + objADOAdapter.Command);