DataSource.QueryConnection プロパティ
データ ソースに関連付けられた DataConnection オブジェクトへの参照を取得します。
名前空間: Microsoft.Office.InfoPath
アセンブリ: Microsoft.Office.InfoPath (Microsoft.Office.InfoPath.dll)
構文
'宣言
Public MustOverride ReadOnly Property QueryConnection As DataConnection
Get
'使用
Dim instance As DataSource
Dim value As DataConnection
value = instance.QueryConnection
public abstract DataConnection QueryConnection { get; }
プロパティ値
型: Microsoft.Office.InfoPath.DataConnection
データ ソースに関連付けられた DataConnection。
解説
QueryConnection プロパティが返す DataConnection オブジェクトへの参照を設定すると、特定の DataConnection オブジェクトが提供するプロパティとメソッドを使用できるようになります。
このメンバーには、現在開いているフォームと同じドメインで実行中のフォーム、またはクロスドメインのアクセス許可が与えられたフォームのみがアクセスできます。
この型またはメンバーには、Microsoft InfoPath Filler または Web ブラウザーで開かれたフォームを実行中のコードからアクセスできます。
例
次の例では、DataSource オブジェクトの QueryConnection プロパティを使用して、DataSource オブジェクトに関連付けられたデータ接続 (この例では、ADOQueryConnection オブジェクト) への参照を返します。次に、ADOQueryConnection クラスの Command() プロパティを使用して、SQL コマンド テキストをメッセージ ボックスに表示します。
AdoQueryConnection myConnection =
(AdoQueryConnection)(this.DataSources["CityList"].QueryConnection);
MessageBox.Show("SQL command text: " + myConnection.Command);
Dim myConnection As AdoQueryConnection = _
DirectCast(Me.DataSources("CityList").QueryConnection, _
AdoQueryConnection) ;
MessageBox.Show("SQL command text: " & myConnection.Command)