DataConnectionCollection.Item プロパティ (String)
コレクション内の名前で指定された DataConnection オブジェクトへの参照を取得します。
名前空間: Microsoft.Office.InfoPath
アセンブリ: Microsoft.Office.InfoPath (microsoft.office.infopath.dll 内)
構文
'宣言
Public MustOverride ReadOnly Default Property Item ( _
name As String _
) As DataConnection
'使用
Dim instance As DataConnectionCollection
Dim name As String
Dim value As DataConnection
value = instance(name)
public abstract DataConnection this [
string name
] { get; }
パラメータ
- name
取得する DataConnection オブジェクトの名前。
プロパティ値
取得する DataConnection オブジェクトの名前。
コメント
Item プロパティから返された DataConnection オブジェクトへの参照を設定した後、対応するデータ接続用の適切な型にオブジェクトをキャストすると、その任意のプロパティおよびメソッドにアクセスできるようになります。たとえば、電子メールでフォームを送信するためのデータ接続のプロパティとメソッドにアクセスするには、返された DataConnection オブジェクトを EmailSubmitConnection 型にキャストする必要があります。
このメンバは制限なしでアクセスできます。
この型またはメンバは、Microsoft Office InfoPath 2007 または Web ブラウザで開いているフォームで実行されているコードからのみアクセスできます。
例
次の例では、"Employees" という名前の DataConnection オブジェクトを DataConnectionCollection から取得し、AdoQueryConnection 型 (Access または SQL Server のデータベースからデータを取得するためのデータ接続を表す型) にキャストしています。
// 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)
関連項目
参照
DataConnectionCollection クラス
DataConnectionCollection のメンバ
Microsoft.Office.InfoPath 名前空間