Edit

Share via


DataSource Class

Definition

Represents a data source in a form template.

public ref class DataSource abstract
public abstract class DataSource
type DataSource = class
Public MustInherit Class DataSource
Inheritance
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 Microsoft.Office.InfoPath.SharepointListRWQueryConnection or Microsoft.Office.InfoPath.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.

Constructors

DataSource()

Properties

Name

Gets the name of the associated DataSource object.

QueryConnection

Gets a reference to the DataConnection object associated with the data source.

ReadOnly

Gets a value that indicates whether the data source is in a read-only state.

Methods

CreateNavigator()

Returns an XPathNavigator

GetNamedNodeProperty(XPathNavigator, String)

Gets the value of a named property for the specified XML node, which must be a nonattribute node in the main data source.

SetNamedNodeProperty(XPathNavigator, String, String)

Sets the value of a named property for the specified XML node, which must be a nonattribute node in the main data source.

Applies to