DataConnection クラス
データ接続の個々の具体的な型が派生する基底クラスを表します。
継承階層
System.Object
Microsoft.Office.InfoPath.DataConnection
名前空間: Microsoft.Office.InfoPath
アセンブリ: Microsoft.Office.InfoPath (Microsoft.Office.InfoPath.dll)
構文
'宣言
Public MustInherit Class DataConnection
'使用
Dim instance As DataConnection
public abstract class DataConnection
解説
各データ接続は、メイン データ ソースまたはセカンダリ データ ソースに挿入されたデータを取得したり、データを送信したりするために使用されます。
メイン データ ソースに関するデータの取得または送信に使用されるデータ接続は、次のいずれかのデータ接続オブジェクト型に対応します。
セカンダリ データ ソースのデータの取得に使用されるデータ接続は、次のいずれかのデータ接続オブジェクト型に対応します。
SharePointListRWQueryConnection
注意
InfoPath の以前のバージョンで使用されていた SharepointListQueryConnection オブジェクトは現在使用されていません。
データの送信だけに使用されるデータ接続は、次のいずれかのデータ接続オブジェクト型に対応します。
特定の種類のデータ接続用の DataConnection オブジェクトにアクセスするには、フォーム テンプレートと関連付けられている DataConnectionCollection オブジェクトを使用します。DataConnectionCollection オブジェクトにアクセスするには、XmlForm クラスの DataConnections プロパティを使用します。
DataConnectionCollection から返されるオブジェクトのプロパティまたはメソッドを使用するには、使用しているデータ接続の種類を表す型にオブジェクトをキャストした後、これらのメンバーにアクセスする必要があります。たとえば、AdoQueryConnection オブジェクト (Access または SQL Server データベースからデータを取得するためのデータ接続を表します) を使用するには、次の例で示すように、DataConnectionCollection から返されたオブジェクトをキャストする必要があります。
// Get the Employees connection from the
// DataConnections collection.
AdoQueryConnection myAdoQueryConnection =
(AdoQueryConnection)(this.DataConnections["Employees"]);
' Get the Employees connection from the
' DataConnections collection.
Dim myAdoQueryConnection As AdoQueryConnection = _
DirectCast(Me.DataConnections("Employees"), AdoQueryConnection)
データ接続の使い方の詳細については、「[方法] 外部データ ソースにアクセスする方法」を参照してください。
スレッドの安全性
この型の public static (Visual Basic ではShared ) メンバーはスレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。
関連項目
参照
Microsoft.Office.InfoPath 名前空間
継承階層
System.Object
Microsoft.Office.InfoPath.DataConnection
Microsoft.Office.InfoPath.AdoQueryConnection
Microsoft.Office.InfoPath.AdoSubmitConnection
Microsoft.Office.InfoPath.BdcQueryConnection
Microsoft.Office.InfoPath.BdcSubmitConnection
Microsoft.Office.InfoPath.EmailSubmitConnection
Microsoft.Office.InfoPath.FileQueryConnection
Microsoft.Office.InfoPath.FileSubmitConnection
Microsoft.Office.InfoPath.SharepointListQueryConnection
Microsoft.Office.InfoPath.SharePointListRWQueryConnection
Microsoft.Office.InfoPath.SharePointListRWSubmitConnection
Microsoft.Office.InfoPath.SubmitToHostConnection
Microsoft.Office.InfoPath.WebServiceConnection