TableName
StringtableName
= DataTable.TableName; DataTable.TableName =tableName
;
Gets or sets the name of the DataTable
.
The following example sets the name of a newly created
DataTable
:
DataTable dt = new DataTable(); dt.TableName = "MyTable";
The value for the TableName
property can also be
set using the DataTable
constructor as shown in
the following example:
DataTable dt = new DataTable("MyDataTable");
If the contents of the DataSet
containing the
table are output as XML, the TableName
is used as
the element tag for each row in the DataTable
.
By default, TableName
property has no value. If
the value has not been set when the table is added to the
DataTableCollection
of a
DataSet
, the table name defaults to Table, Table1,
and so on.