Compartir a través de


DataSource.Name Property

Gets the name of the associated DataSource object.

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

Syntax

'Declaration
Public MustOverride ReadOnly Property Name As String
    Get
'Usage
Dim instance As DataSource
Dim value As String

value = instance.Name
public abstract string Name { get; }

Property Value

Type: System.String
If the DataSource object represents a secondary data source, returns the name of the data source. If the DataSource object represents the primary (main) data source, returns String.Empty.

Remarks

If the data source is a secondary data source, the name of the DataSource object is the same as the name of the data source that it represents. For secondary data sources, the name of the DataSource object can also be used as the argument to the Item() property of the DataConnectionCollection class.

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

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

Examples

In the following example, the name of each DataSource object in the DataSourceCollection is displayed in a message box.

foreach (DataSource source in this.DataSources)
{
   MessageBox.Show("Source name: " + source.Name);
}
For Each source As DataSource In Me.DataSources
{
   MessageBox.Show("Source name: " & source.Name)
}

See Also

Reference

DataSource Class

DataSource Members

Microsoft.Office.InfoPath Namespace