We recommend using Visual Studio 2017

ADOAdapterObject Interface

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


Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in microsoft.office.interop.infopath.semitrust.dll)

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, see ADOAdapter2.

The ADOAdapter object is a type of Microsoft Office InfoPath 2007 data adapter that contains all the information necessary for retrieving and submitting data to an external data source.

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 a SQL command text fragment based on a specified XML node's attributes.

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.

// retrieve the Employees Adapter from the DataAdapters collection
ADOAdapter employeesDA=(ADOAdapter)thisXDocument.DataAdapters["Employees"];
// get employee’s ID from the main DOM
string employeeID=thisXDocument.DOM.selectSingleNode("//my:field2").text;
// Change the ADOAdapter’s command to retrieve the record of the Employee’s ID entered
// by the user
employeesDA.Command="select * from Employees where EmployeeID="+employeeID;
// get DataObject from the DataObjects collection and call Query to refresh
// the data object
DataObject employeesDO=thisXDocument.DataObjects["Employees"];