Share via


DataSource class

Represents a data source in a form template.

Inheritance hierarchy

System.Object
  Microsoft.Office.InfoPath.DataSource

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustInherit Class DataSource
'Usage
Dim instance As DataSource
public abstract class DataSource

Remarks

A DataSource object corresponds to one of the sources of stored data associated with an InfoPath 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 first 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 InfoPath supports the following kinds of data connections:

  • A connection query or submit using ActiveX Data Objects (ADO) represented by the AdoQueryConnection and AdoSubmitConnection objects.

  • A connection to query or submit to an external data source that is registered in the Business Data Connectivity service (BDC) a server running SharePoint Foundation 2010 or SharePoint Server 2010 represented by the BdcQueryConnection or BdcSubmitConnection objects.

  • A connection to query or submit to a SharePoint list represented by the SharepointListRWQueryConnection or SharepointListRWSubmitConnection objects.

  • A connection to a Web service represented by the WebServiceConnection object.

  • A connection to query or submit to an XML file represented by the FileQueryConnection and FileSubmitConnection objects.

  • A connection to submit by e-mail represented by the EmailSubmitConnection object.

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

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