DataConnectionCollection.Item Property (String) (Microsoft.Office.InfoPath)

Gets a reference to the specified DataConnection object from the collection by name.

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

Syntax

'Declaration
Public MustOverride ReadOnly Default Property Item ( _
    name As String _
) As DataConnection
'Usage
Dim instance As DataConnectionCollection
Dim name As String
Dim value As DataConnection

value = instance(name)
public abstract DataConnection this [
    string name
] { get; }

Parameters

  • name
    The name of the DataConnection object to get.

Property Value

The name of the DataConnection object to get.

Remarks

After you have set a reference to the DataConnection object that the Item property returns, you can access any of its properties or methods after the object has been cast to the appropriate type for the corresponding data connection. For example, to access the properties and methods of a data connection for submitting a form in e-mail, you must cast the returned DataConnection object to the EmailSubmitConnection type.

This member can be accessed without restrictions.

This type or member can be accessed from code running in forms opened in Microsoft Office InfoPath 2007 or in a Web browser.

Example

In the following example, the DataConnection object named "Employees" is retrieved from the DataConnectionCollection, and then cast to the AdoQueryConnection type (which represents a data connection for retrieving data from an Access or SQL Server database).

   // 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)

See Also

Reference

DataConnectionCollection Class
DataConnectionCollection Members
Microsoft.Office.InfoPath Namespace