DataTable.TableName Property

Gets or sets the name of the DataTable.

Namespace: System.Data
Assembly: System.Data (in

public string TableName { get; set; 
/** @property */
public String get_TableName ()

/** @property */
public void set_TableName (String value)

public function get TableName () : String

public function set TableName (value : String)

Property Value

The name of the DataTable.

Exception typeCondition


a null reference (Nothing in Visual Basic) or empty string ("") is passed in and this table belongs to a collection.


The table belongs to a collection that already has a table with the same name. (Comparison is case-sensitive).

The TableName is used to return this table from the parent DataSet object's DataTableCollection (returned by the Tables property).

The following example prints the TableName for each table in a collection of DataTable objects.

private void GetTableNames(DataSet dataSet)
    // Print each table's TableName.
    foreach(DataTable table in dataSet.Tables)

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions