XDocument.QueryAdapter Property

InfoPath Developer Reference

A read-only property that returns a reference to the data adapter object that is associated with a Microsoft Office InfoPath 2007 form. Read-only

Version Information
 Version Added:  InfoPath 2003

Syntax

expression.QueryAdapter

expression   An expression that returns a XDocument object.

Return Value
Object

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 of the XDocument object.

Office InfoPath 2007 supports three types of data adapters:

  1. ActiveX Data Objects, represented by the ADOAdapter object.
  2. Web services, represented by the WebServiceAdapter object.
  3. XML file, represented by the XMLFileAdapter object.
Bb250843.vs_note(en-us,office.12).gif  Note
The XMLFileAdapter object cannot be used with the QueryAdapter property of the XDocument object, it is only used for secondary data sources. To access a form's underlying XML document, use the DOM property of the XDocument 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.

Example

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

JScript
  var objADOAdapter;

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

See Also