Edit

Share via


_XDocument4.QueryAdapter Property

Definition

Gets a reference to the data adapter object that is associated with a Microsoft InfoPath form.

public:
 property System::Object ^ QueryAdapter { System::Object ^ get(); };
public object QueryAdapter { get; }
member this.QueryAdapter : obj
Public ReadOnly Property QueryAdapter As Object

Property Value

Implements

Examples

In the following example, the QueryAdapter property of the XDocument object is used to set a reference to the ADOAdapterObject object; then the Command property of the ADOAdapter object is used to display the SQL command text in a message box:

ADOAdapter2 adapter;

adapter = (ADOAdapter2) thisXDocument.<span class="label">QueryAdapter</span>;
thisXDocument.UI.Alert("SQL command text: " + adapter.Command);

In the following example, the QueryAdapter property of the XDocument object is used to set a reference to the ADOAdapterObject object; then the Command property of the ADOAdapter object is used to display the SQL command text in a message box:

ADOAdapter2 adapter;

adapter = (ADOAdapter2) thisXDocument.<span class="label">QueryAdapter</span>;
thisXDocument.UI.Alert("SQL command text: " + adapter.Command);

Remarks

Data adapter objects provide different properties and methods that retrieve and submit data to external data sources; the data adapter that is associated with a form is dependent on the type of data source that was used when the form was initially created.

The QueryAdapter property allows you to access an InfoPath form's primary data source. To access the data adapter objects used for a form's secondary data sources, use the DataObjects property.

Important: This member 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.

Applies to