|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Represents a connection to a Microsoft ActiveX Data Objects/OLEDB data source.
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, seeADOAdapter2.
The ADOAdapter object is a type of Microsoft InfoPath 2010 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.
// 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"]; employeesDO.Query();