asp.net.ph

DataTable.TableName Property

System.Data Namespace   DataTable Class


Sets or retrieves the name of the the DataTable.

Syntax


Script DataTable.TableName [ = strName ]

Property Value


strName The name of the the DataTable.

The property is read/write with no default value.

Exceptions


Exception Type Condition
ArgumentException Occurs when a null reference or empty string ( "" ) is passed in and this table belongs to a collection.
DuplicateNameException Occurs when the table belongs to a collection that already has a table with the same name ( and the comparison is not case-sensitive ).

Remarks

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

Example

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

private void TableNameDemo ( DataSet myDataSet ) {
   // print each table's TableName.

   foreach ( DataTable tbl in myDataSet.Tables ) {
      Response.Write ( tbl.TableName );
   }
}
  C# VB

See Also

DataTable Members   DataSet   Tables Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph