|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
FileQueryConnection Class (Microsoft.Office.InfoPath)
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)
The FileQueryConnection class represents a data connection created in InfoPath using the Data Connection Wizard that specifies all the information necessary for retrieving data from an XML file that is used as a secondary (external) data source.
The FileQueryConnection object can also be accessed from DataSourceCollection of the form template using the DataSources property of the XmlForm, and the QueryConnection property of the DataSource class as shown in the following line of code.
FileQueryConnection myDataSource = (FileQueryConnection)(DataSources["XMLFile"].QueryConnection);
The FileQueryConnection class provides the FileLocation property, which can be used get or set the Uniform Resource Locator (URL) or universal naming convention (UNC) path of the XML file that is being used an external data source.
In addition to the default Execute method inherited from the DataConnection base class that performs a query operation using the values that were declaratively defined in InfoPath form template design mode, the FileQueryConnection class also provides the FileQueryConnection.Execute method, which allows you to specify a different XML node in which to insert the data returned from the external XML file.
The FileQueryConnection class corresponds to the XMLFileAdapterObject class of the Microsoft Office InfoPath 2003 object model.