Edit

Share via


DataSource.Name Property

Definition

Gets the name of the associated DataSource object.

public:
 abstract property System::String ^ Name { System::String ^ get(); };
public abstract string Name { get; }
member this.Name : string
Public MustOverride ReadOnly Property Name As String

Property Value

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.

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

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 Microsoft.Office.InfoPath.DataConnectionCollection.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.

Applies to