_XDocument2.QueryAdapter property

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

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

Syntax

'Declaration
ReadOnly Property QueryAdapter As Object
    Get
'Usage
Dim instance As _XDocument2
Dim value As Object

value = instance.QueryAdapter
Object QueryAdapter { get; }

Property value

Type: System.Object

Implements

_XDocument.QueryAdapter

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.

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.QueryAdapter;
thisXDocument.UI.Alert("SQL command text: " + adapter.Command);

See also

Reference

_XDocument2 interface

_XDocument2 members

QueryAdapter overload

Microsoft.Office.Interop.InfoPath.SemiTrust namespace