DataSource Class

Represents a data source in a form template.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Syntax

'Declaration
'Usage

Remarks

A DataSource object corresponds to one of the sources of stored data associated with an Microsoft Office InfoPath 2007 form template. A DataSource object can represent either the form template's primary (main) data source, or a secondary data source obtained from some external source of data using an associated data connection (referred to as a data adapter in the previous release of Microsoft InfoPath). Working with a form's main data source provides access to the underlying XML document of the form, whereas working with a secondary data source provides access to data retrieved from an external source of data such as a Web Service query.

The DataSource object provides properties and methods that can be used to programmatically interact with the stored data, as well as providing access to the associated data connection for secondary data sources. A DataSource object can be accessed using the DataSources property of the XmlForm class.

For secondary data sources, a DataSource object acts as an intermediary between the form and the data connection that is used to obtain data from an external data source, such as a connection to a Microsoft Access or Microsoft SQL Server database, an .xml file, or an XML Web service. The type of data connection object used depends on the type of external data connection used to acquire the data. The DataSource object provides a common set of properties and methods that can be used for all types of data connection objects, and each of the data connection objects provides its own set of properties and methods.

Microsoft Office InfoPath 2007 supports the following kinds of data connections:

The DataSource class corresponds to the DataObject interface in the Microsoft InfoPath 2003 object model.

Inheritance Hierarchy

System.Object
  Microsoft.Office.InfoPath.DataSource

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

DataSource Members
Microsoft.Office.InfoPath Namespace