DataTableCollection Class

 

Represents the collection of tables for the DataSet.

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

System::Object
  System.Data::InternalDataCollectionBase
    System.Data::DataTableCollection

[ListBindableAttribute(false)]
public ref class DataTableCollection sealed : InternalDataCollectionBase

NameDescription
System_CAPS_pubpropertyCount

Gets the total number of elements in a collection.(Inherited from InternalDataCollectionBase.)

System_CAPS_pubpropertyIsReadOnly

Gets a value that indicates whether the InternalDataCollectionBase is read-only.(Inherited from InternalDataCollectionBase.)

System_CAPS_pubpropertyIsSynchronized

Gets a value that indicates whether the InternalDataCollectionBase is synchonized.(Inherited from InternalDataCollectionBase.)

System_CAPS_pubpropertyItem[Int32]

Gets the DataTable object at the specified index.

System_CAPS_pubpropertyItem[String^]

Gets the DataTable object with the specified name.

System_CAPS_pubpropertyItem[String^, String^]

Gets the DataTable object with the specified name in the specified namespace.

System_CAPS_pubpropertySyncRoot

Gets an object that can be used to synchronize the collection.(Inherited from InternalDataCollectionBase.)

NameDescription
System_CAPS_pubmethodAdd()

Creates a new DataTable object by using a default name and adds it to the collection.

System_CAPS_pubmethodAdd(DataTable^)

Adds the specified DataTable to the collection.

System_CAPS_pubmethodAdd(String^)

Creates a DataTable object by using the specified name and adds it to the collection.

System_CAPS_pubmethodAdd(String^, String^)

Creates a DataTable object by using the specified name and adds it to the collection.

System_CAPS_pubmethodAddRange(array<DataTable^>^)

Copies the elements of the specified DataTable array to the end of the collection.

System_CAPS_pubmethodCanRemove(DataTable^)

Verifies whether the specified DataTable object can be removed from the collection.

System_CAPS_pubmethodClear()

Clears the collection of all DataTable objects.

System_CAPS_pubmethodContains(String^)

Gets a value that indicates whether a DataTable object with the specified name exists in the collection.

System_CAPS_pubmethodContains(String^, String^)

Gets a value that indicates whether a DataTable object with the specified name and table namespace exists in the collection.

System_CAPS_pubmethodCopyTo(Array^, Int32)

Copies all the elements of the current InternalDataCollectionBase to a one-dimensional Array, starting at the specified InternalDataCollectionBase index.(Inherited from InternalDataCollectionBase.)

System_CAPS_pubmethodCopyTo(array<DataTable^>^, Int32)

Copies all the elements of the current DataTableCollection to a one-dimensional Array, starting at the specified destination array index.

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetEnumerator()

Gets an IEnumerator for the collection.(Inherited from InternalDataCollectionBase.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodIndexOf(DataTable^)

Gets the index of the specified DataTable object.

System_CAPS_pubmethodIndexOf(String^)

Gets the index in the collection of the DataTable object with the specified name.

System_CAPS_pubmethodIndexOf(String^, String^)

Gets the index in the collection of the specified DataTable object.

System_CAPS_pubmethodRemove(DataTable^)

Removes the specified DataTable object from the collection.

System_CAPS_pubmethodRemove(String^)

Removes the DataTable object with the specified name from the collection.

System_CAPS_pubmethodRemove(String^, String^)

Removes the DataTable object with the specified name from the collection.

System_CAPS_pubmethodRemoveAt(Int32)

Removes the DataTable object at the specified index from the collection.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_pubeventCollectionChanged

Occurs after the DataTableCollection is changed because of DataTable objects being added or removed.

System_CAPS_pubeventCollectionChanging

Occurs while the DataTableCollection is changing because of DataTable objects being added or removed.

NameDescription
System_CAPS_pubmethodAsParallel()

Overloaded. Enables parallelization of a query.(Defined by ParallelEnumerable.)

System_CAPS_pubmethodAsQueryable()

Overloaded. Converts an IEnumerable to an IQueryable.(Defined by Queryable.)

System_CAPS_pubmethodCast<TResult>()

Casts the elements of an IEnumerable to the specified type.(Defined by Enumerable.)

System_CAPS_pubmethodOfType<TResult>()

Filters the elements of an IEnumerable based on a specified type.(Defined by Enumerable.)

The DataTableCollection contains all the DataTable objects for a particular DataSet. To access the DataTableCollection of a DataSet, use the Tables property.

The DataTableCollection uses methods such as Add, Clear, and Remove to manage the items in the collection.

Use the Contains method to determine whether a particular table (specified by either index or name) is in the collection.

To navigate from one table to another, use the ChildRelations or ParentRelations property of the DataTable to access its collection of DataRelation objects. You can also use the Relations property to navigate through the parent/child relationships of the DataTables in a particular DataSet collection.

The first procedure in this example retrieves the DataTableCollection of a DataSet and prints the value of each column, in each row, of each table. The second procedure creates a new DataTable with two columns, and adds it to the DataTableCollection.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1

This type is safe for multithreaded read operations. You must synchronize any write operations.

Return to top
Show: