Share via


ADOAdapter Object

InfoPath Developer Reference

Represents a connection to a Microsoft ActiveX Data Objects/OLEDB data source.

Version Information
 Version Added:  InfoPath 2003

Remarks

The ADOAdapter object is a type of Microsoft data adapter that contains all the information necessary for retrieving and submitting data to an external data source. For secondary data sources, the ADOAdapter object provides properties that can be used to get and set information about the data adapter's connection string, SQL command text, and timeout value. It also provides a method for creating an SQL command text fragment based on a specified XML node. If an ADO/OLEDB data source is used as the primary data source for a form, the ADOAdapter object is accessible through the QueryAdapter property of the XDocument object.

Bb229840.vs_note(en-us,office.12).gif  Note
The ADOAdapter object is limited to work only with Microsoft SQL Server and Microsoft Access databases.

The ADOAdapter object is accessible through the QueryAdapter property of the DataObject object, and DataObject objects are accessible through the DataObjects property of the XDocument object.

For more information about using the ADOAdapter object, see Working with data in a form's secondary data sources.

Example

In the following example, the Timeout property of the ADOAdapter object is used to set the timeout for a particular query operation, returning the timeout to its original value after the query operation is complete:

JScript
  
          function RunLongQuery()
          {
      var objADOAdapter;
      var intTimeout;

      // Set a reference to the ADOAdapter object.
      objADOAdapter = XDocument.DataObjects("CityDropDownList").QueryAdapter;

      // Save the original timeout value.
      intTimeout = objADOAdapter.Timeout;

      // Set a longer timeout value and then run the query.
      objADOAdapter.Timeout = 60;
      XDocument.DataObjects("CityDropDownList").Query();

      // Restore the original timeout value.
      objADOAdapter.Timeout = intTimeout;

      objADOAdapter = null;
      intTimeout = null;
      }
    </code>

See Also