次の方法で共有


DataAdaptersCollection インターフェイス

定義

Microsoft InfoPath フォーム内で使用される各データ接続に対応するデータ アダプター オブジェクトを格納します。

public interface class DataAdaptersCollection : Microsoft::Office::Interop::InfoPath::SemiTrust::DataAdapters
[System.Runtime.InteropServices.Guid("096cd692-0786-11d1-95fa-0080c78ee3bb")]
public interface DataAdaptersCollection : Microsoft.Office.Interop.InfoPath.SemiTrust.DataAdapters
type DataAdaptersCollection = interface
    interface DataAdapters
Public Interface DataAdaptersCollection
Implements DataAdapters
属性
実装

次の例では、Northwind データベースの Employees テーブルに接続されている ADOAdapter オブジェクトを DataAdapters コレクションから取得します。

// retrieve the Employees Adapter from the DataAdapters collection
ADOAdapter employeesDA = (ADOAdapter)thisXDocument.<span class="label">DataAdapters</span>["Employees"];

次の例では、XML ファイル データ接続として使用できる、"form1" という名前の XML ドキュメントを、DataAdapters コレクションから取得します。 この接続のさまざまなプロパティがメッセージ ボックスに表示されます。

<span class="label">DataAdapters</span> dataAdapters;
XMLFileAdapterObject xmlFileAdapterObject;

dataAdapters = thisXDocument.<span class="label">DataAdapters</span>; 
xmlFileAdapterObject = dataAdapters["form1"] as XMLFileAdapterObject;

if (xmlFileAdapterObject == null)
{
 thisXDocument.UI.Alert("The DataAdapter does not exist or is not an XMLFileAdapterObject.");
}
else
{
 thisXDocument.UI.Alert("XML file adapter" + "\n\n" + "Name: " + xmlFileAdapterObject.Name + "\n" + "QueryAllowed: " + xmlFileAdapterObject.QueryAllowed+ "\n" + "SubmitAllowed: " + xmlFileAdapterObject.SubmitAllowed+ "\n" + "FileURL: " + xmlFileAdapterObject.FileURL);

 // Perform the query.
 try
 {
  xmlFileAdapterObject.Query();
 }
 catch (Exception ex)
 {
  thisXDocument.UI.Alert("Failed to query.\n\n" + ex.Message);
 }

 // Perform the submit.
 try
 {
  xmlFileAdapterObject.Submit();
 }
 catch (Exception ex)
 {
  thisXDocument.UI.Alert("Failed to submit.\n\n" + ex.Message);
 }
}

注釈

この型は、COM の相互運用性を得るためにマネージ コードが必要とするコクラスのラッパーです。 この型を使用して、このコクラスによって実装される COM インターフェイスにアクセスします。 COM インターフェイスの詳細については、そのメンバーの説明へのリンクを参照してくださいDataAdapters

各データ接続は、メイン データ ソースまたはセカンダリ データ ソースに挿入されたデータを取得したり、データを送信したりするために使用されます。

メイン データ ソースのデータの取得に使用されるデータ接続は、次のどちらかの種類のデータ アダプター オブジェクトに対応します。

: メイン データ ソースのデータを取得するために使用される ADOAdapter オブジェクトは、データを送信することもできます。

セカンダリ データ ソースのデータの取得に使用されるデータ接続は、次のいずれかの種類のデータ アダプター オブジェクトに対応します。

データの送信のみに使用されるデータ接続は、次のいずれかの種類のデータ アダプター オブジェクトに対応します。

DataAdapters コレクションには、 オブジェクトの XDocument プロパティをDataAdapters使用してアクセスできます。

: データ アダプター オブジェクトのプロパティまたはメソッドを使用するには、 DataAdaptersCollection オブジェクトから返されたオブジェクトを、それらのメンバーにアクセスする前に、そのオブジェクトが表す特定のデータ アダプターにキャストする必要があります。 データ アダプターの操作の詳細については、「[方法] InfoPath 2003 オブジェクト モデルを使用して外部データ ソースにアクセスする方法」を参照してください。

プロパティ

Count

コレクション内 DataAdaptersCollection のデータ アダプターの数を取得します。

(継承元 DataAdapters)
Item[Object]

位置または名前に基づいて、コレクションから DataAdaptersCollection 指定したデータ アダプター オブジェクトへの参照を取得します。

(継承元 DataAdapters)

メソッド

GetEnumerator()

オブジェクト内のすべてのエントリを反復処理する IEnumeratorDataAdaptersEnumerator 取得します。

(継承元 DataAdapters)

適用対象