共用方式為


ADOAdapterObject 介面

表示 Microsoft ActiveX 資料物件/OLEDB 資料來源的連線。

**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)

語法

'宣告
<GuidAttribute("096CD5D3-0786-11D1-95FA-0080C78EE3BB")> _
<CoClassAttribute(GetType(ADOAdapterObjectClass))> _
Public Interface ADOAdapterObject
    Inherits ADOAdapter2
'用途
Dim instance As ADOAdapterObject
[GuidAttribute("096CD5D3-0786-11D1-95FA-0080C78EE3BB")] 
[CoClassAttribute(typeof(ADOAdapterObjectClass))] 
public interface ADOAdapterObject : ADOAdapter2

備註

此類型為 coclass 的包裝函式,屬於 COM 互通性中 Managed 程式碼的必要項。使用此類型,即可存取由此 coclass 實作的 COM 介面成員。如需 COM 介面 (包括其成員說明連結) 的詳細資訊,請參閱 ADOAdapter2

ADOAdapter 物件是一種 Microsoft Office InfoPath 2007 資料中繼層,包含對外部資料來源擷取和傳送資料時所需的所有資訊。

ADOAdapter 物件提供了一些屬性,可用於取得及設定資料中繼層之連接字串、SQL 指令文字及逾時值的相關資訊。還提供一種依據指定的 XML 節點屬性,建立 SQL 指令文字片段的方法。

如果使用 ADO/OLEDB 資料來源做為表單的主要資料來源,即可透過 XDocument 物件的 QueryAdapter 屬性來存取 ADOAdapter 物件。

範例

// 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();

請參閱

參考

ADOAdapterObject 成員
Microsoft.Office.Interop.InfoPath 命名空間