次の方法で共有


DataConnection Class

Represents the base class from which each specific type of data connection is derived.

Inheritance Hierarchy

System.Object
  Microsoft.Office.InfoPath.DataConnection
    

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

Syntax

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

Remarks

Each data connection is used to retrieve data (inserted into the main data source or into a secondary data source) or to submit data.

A data connection used to retrieve or submit data for the main data source will correspond to one of the following data connection object types:

A data connection used to retrieve data for a secondary data source will correspond to one of the following data connection object types:

A data connection used only for submitting data will correspond to one of the following data connection object types:

To access a DataConnection object for a particular kind of data connection, use the DataConnectionCollection object associated with the form template. To access the DataConnectionCollection object, use the DataConnections property of the XmlForm class.

To use the properties or methods of the object returned from the DataConnectionCollection, you must cast that object to the type that represents the kind of data connection you are working with before you can access those members. For example, to work with an AdoQueryConnection object (which represents a data connection for retrieving data from an Access or SQL Server database), you must cast the object returned from the DataConnectionCollection as shown in the following examples.

   // Get the Employees connection from the 
   // DataConnections collection.
   AdoQueryConnection myAdoQueryConnection =
      (AdoQueryConnection)(this.DataConnections["Employees"]);
   ' Get the Employees connection from the 
   ' DataConnections collection.
   Dim myAdoQueryConnection As AdoQueryConnection = _
      DirectCast(Me.DataConnections("Employees"), AdoQueryConnection)

For more information about working with data connections, see How to: Access External Data Sources.

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

DataConnection Members

Microsoft.Office.InfoPath Namespace

Inheritance Hierarchy

System.Object
  Microsoft.Office.InfoPath.DataConnection
    Microsoft.Office.InfoPath.AdoQueryConnection
    Microsoft.Office.InfoPath.AdoSubmitConnection
    Microsoft.Office.InfoPath.BdcQueryConnection
    Microsoft.Office.InfoPath.BdcSubmitConnection
    Microsoft.Office.InfoPath.EmailSubmitConnection
    Microsoft.Office.InfoPath.FileQueryConnection
    Microsoft.Office.InfoPath.FileSubmitConnection
    Microsoft.Office.InfoPath.SharepointListQueryConnection
    Microsoft.Office.InfoPath.SharePointListRWQueryConnection
    Microsoft.Office.InfoPath.SharePointListRWSubmitConnection
    Microsoft.Office.InfoPath.SubmitToHostConnection
    Microsoft.Office.InfoPath.WebServiceConnection