XmlForm.QueryDataConnection 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 that represents the data connection that is associated with the form.
public:
abstract property Microsoft::Office::InfoPath::DataConnection ^ QueryDataConnection { Microsoft::Office::InfoPath::DataConnection ^ get(); };
public abstract Microsoft.Office.InfoPath.DataConnection QueryDataConnection { get; }
member this.QueryDataConnection : Microsoft.Office.InfoPath.DataConnection
Public MustOverride ReadOnly Property QueryDataConnection As DataConnection
Property Value
A DataConnection that represents the data connection that is associated with the form.
Examples
In the following code example, the QueryDataConnection property of the XmlForm class is used to set a reference to the Microsoft.Office.InfoPath.ADOQueryConnection and Microsoft.Office.InfoPath.ADOSubmitConnection objects associated with the form template. Then the Command property of the ADOQueryConnection object and the Command property of the ADOQueryConnection objects are used to display the SQL command text for each connection type in a message box
ADOQueryConnection queryConnection;
ADOSubmitConnection submitConnection;
queryConnection = (ADOQueryConnection) this.QueryConnection;
MessageBox.Show("Query SQL command text: " + queryConnection.Command);
submitConnection = (ADOSubmitConnection) this.QueryConnection;
MessageBox.Show("Submit SQL command text: " + querySubmit.Command);
Dim queryConnection As ADOQueryConnection
Dim submitConnectionmAs ADOSubmitConnection
queryConnection = DirectCast(ADOQueryConnection, Me.QueryConnection)
MessageBox.Show("Query SQL command text: " & queryConnection.Command)
submitConnection = DirectCast(ADOSubmitConnection, Me.QueryConnection)
MessageBox.Show("Submit SQL command text: " & querySubmit.Command)
Remarks
DataConnection objects provide properties and methods that retrieve and submit data to external data sources; the data connection that is associated with a form is dependent on the type of data source that was used when the form was initially created.
The QueryDataConnection property allows you to access an InfoPath form's primary data source. To access the data adapter objects used for a form's secondary data sources, use the DataSources property.
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.