This documentation is archived and is not being maintained.

DataColumn.Table Property

Gets the DataTable to which the column belongs to.

[Visual Basic]
Public ReadOnly Property Table As DataTable
public DataTable Table {get;}
public: __property DataTable* get_Table();
public function get Table() : DataTable;

Property Value

The DataTable that the DataColumn belongs to.


[Visual Basic, C#, C++] The following example returns the parent table of a DataColumn through its Table property.

[Visual Basic] 
Private Sub GetTable(ByVal myColumn As DataColumn)
    ' Get the Table of the column.
    Dim myTable As DataTable
    myTable = myColumn.Table
    Console.WriteLine("columns", myTable.Columns.Count)
    Console.WriteLine("rows", myTable.Rows.Count)
 End Sub

private void GetTable(DataColumn myColumn){
    // Get the Table of the column.
    DataTable myTable;
    myTable = myColumn.Table;
    Console.WriteLine("columns count: " + myTable.Columns.Count);
    Console.WriteLine("rows count: " + myTable.Rows.Count);

void GetTable(DataColumn* myColumn){
    // Get the Table of the column.
    DataTable* myTable;
    myTable = myColumn->Table;
    Console::WriteLine(S"columns count: {0}", __box(myTable->Columns->Count));
    Console::WriteLine(S"rows count: {0}", __box(myTable->Rows->Count));

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataColumn Class | DataColumn Members | System.Data Namespace | DataTable