次の方法で共有


ADOAdapter2.Connection プロパティ

ADOAdapterObject オブジェクトに使用される接続文字列を取得または設定します。

このプロパティは、CLS に準拠していません。  

名前空間: Microsoft.Office.Interop.InfoPath.SemiTrust
アセンブリ: Microsoft.Office.Interop.InfoPath.SemiTrust (microsoft.office.interop.infopath.semitrust.dll 内)

構文

'宣言
<DispIdAttribute(5)> _
Property Connection As String
'使用
Dim instance As ADOAdapter2
Dim value As String

value = instance.Connection

instance.Connection = value
[DispIdAttribute(5)] 
string Connection { get; set; }

コメント

ADOAdapter オブジェクトの Connection プロパティには、ADO データ アダプタが ActiveX データ オブジェクト/OLEDB 外部データ ソースに接続するのに使用する接続文字列が含まれています。

メモメモ :

ADOAdapter オブジェクトは、Microsoft SQL Server データベースおよび Microsoft Access データベースでのみ使用できるように制限されています。

メモ重要 :

このメンバは、現在開いているフォームと同じドメイン内で実行されているフォーム、またはドメインを越えたアクセス許可を付与されているフォームだけがアクセスできます。

// retrieve the Employees Adapter from the DataAdapters collection
ADOAdapter employeesDA = (ADOAdapter)thisXDocument.DataAdapters["Employees"];
// Get new server name from the main DOM
string newServer = thisXDocument.DOM.selectSingleNode("//my:serverName").text;
// build new connection string
string connectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;";
connectionString += "Initial Catalog=SalesDB;Data Source=" + newServer;
// set new connection string
employeesDA.Connection = connectionString;
// query the data source again
DataObject employeesDO = thisXDocument.DataObjects["Employees"];
employeesDO.Query();

関連項目

参照

ADOAdapter2 インターフェイス
ADOAdapter2 のメンバ
Microsoft.Office.Interop.InfoPath.SemiTrust 名前空間