Export (0) Print
Expand All

DataSource.Name Property

Office 2010

Gets the name of the associated DataSource object.

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

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.

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.

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);
}
Show:
© 2014 Microsoft