DataSource.QueryConnection Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a reference to the DataConnection object associated with the data source.
public:
abstract property Microsoft::Office::InfoPath::DataConnection ^ QueryConnection { Microsoft::Office::InfoPath::DataConnection ^ get(); };
public abstract Microsoft.Office.InfoPath.DataConnection QueryConnection { get; }
member this.QueryConnection : Microsoft.Office.InfoPath.DataConnection
Public MustOverride ReadOnly Property QueryConnection As DataConnection
Property Value
A DataConnection associated with the data source.
Examples
In the following example, the QueryConnection property of the DataSource object is used to return a reference to the data connection that is associated with the DataSource object, which in this example is an Microsoft.Office.InfoPath.ADOQueryConnection object. The code then uses the Microsoft.Office.InfoPath.ADOQueryConnection.Command property of the Microsoft.Office.InfoPath.ADOQueryConnection class to display the SQL command text in a message box.
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)
Remarks
After you have set a reference to the DataConnection object that the QueryConnection property returns, you can use the properties and methods that the particular DataConnection object provides.
This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.