ADOAdapter Object

Microsoft Office InfoPath

Show All Show All

ADOAdapter Object

ADOAdapter

Represents a connection to a Microsoft ActiveX Data Objects/OLEDB data source. The ADOAdapter object is a type of Microsoft Office InfoPath 2003 data adapter that contains all the information necessary for retrieving and submitting data to an external data source.

Remarks

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.

Note  The ADOAdapter object is limited to work only with Microsoft SQL Server and Microsoft Access databases.

Using the ADOAdapter object

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.

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:

    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;
}

  

For more information about using the ADOAdapter object, see Accessing external data sources.