Export (0) Print
Expand All

DataColumn.Table Property

Gets the DataTable to which the column belongs to.

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

Property Value

The DataTable that the DataColumn belongs to.

Example

[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

[C#] 
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);
 }

[C++] 
private:
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.

Requirements

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

Show:
© 2014 Microsoft