DataColumnCollection

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public class DataColumnCollection implements Iterable

Represents a collection of DataColumn objects for a DataTable.

Methods

MethodDescription
add(System.Data.DataColumn column)Creates and adds the specified DataColumn object to the DataColumnCollection.
add(String columnName)Creates and adds a DataColumn object that has the specified name to the DataColumnCollection.
add(String columnName, Class type)Creates and adds a DataColumn object that has the specified name and type to the DataColumnCollection.
add(String columnName, Class type, int columnMapping, boolean allowAutoIncrement, boolean allowDBNull)Creates and adds a DataColumn with the specified name, type and specific values to the columns collection.
clear()Clears the collection of any columns.
contains(String name)Checks whether the collection contains a column with the specified name.
get(int index)Gets the DataColumn from the collection at the specified index.
get(String name)Gets the DataColumn from the collection with the specified name.
getCount()
indexOf(System.Data.DataColumn column)Gets the index of a column specified by name.
indexOf(String columnName)Gets the index of the column with the specific name (the name is not case sensitive).
iterator()
remove(System.Data.DataColumn column)Removes the specified DataColumn object from the collection.
remove(String name)Removes the DataColumn object that has the specified name from the collection.

add(System.Data.DataColumn column)

public void add(System.Data.DataColumn column)

Creates and adds the specified DataColumn object to the DataColumnCollection.

Parameters:

ParameterTypeDescription
columnDataColumnThe DataColumn to add.

add(String columnName)

public void add(String columnName)

Creates and adds a DataColumn object that has the specified name to the DataColumnCollection.

Parameters:

ParameterTypeDescription
columnNamejava.lang.StringThe name of the column.

add(String columnName, Class type)

public System.Data.DataColumn add(String columnName, Class type)

Creates and adds a DataColumn object that has the specified name and type to the DataColumnCollection.

Parameters:

ParameterTypeDescription
columnNamejava.lang.StringThe DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String) to use when you create the column.
typejava.lang.ClassThe DataColumn.getDataType() / DataColumn.setDataType(java.lang.Class) of the new column.

Returns: DataColumn - The newly created DataColumn.

add(String columnName, Class type, int columnMapping, boolean allowAutoIncrement, boolean allowDBNull)

public System.Data.DataColumn add(String columnName, Class type, int columnMapping, boolean allowAutoIncrement, boolean allowDBNull)

Creates and adds a DataColumn with the specified name, type and specific values to the columns collection.

Parameters:

ParameterTypeDescription
columnNamejava.lang.Stringname
typejava.lang.Classdata type
columnMappingintcolumn mapping type
allowAutoIncrementbooleanis auto increment allowed
allowDBNullbooleanis DBNull value allowed

Returns: DataColumn - created a DataColumn instance.

clear()

public void clear()

Clears the collection of any columns.

contains(String name)

public boolean contains(String name)

Checks whether the collection contains a column with the specified name.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String) of the column to look for.

Returns: boolean - true if a column exists with this name; otherwise, false.

get(int index)

public System.Data.DataColumn get(int index)

Gets the DataColumn from the collection at the specified index.

Parameters:

ParameterTypeDescription
indexintThe zero-based index of the column to return.

Returns: DataColumn - The DataColumn at the specified index.

get(String name)

public System.Data.DataColumn get(String name)

Gets the DataColumn from the collection with the specified name.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String) of the column to return.

Returns: DataColumn - The DataColumn in the collection with the specified DataColumn.getColumnName() / DataColumn.setColumnName(java.lang.String); otherwise a null value if the DataColumn does not exist.

getCount()

public int getCount()

Returns: int - the total number of elements in a collection.

indexOf(System.Data.DataColumn column)

public int indexOf(System.Data.DataColumn column)

Gets the index of a column specified by name.

Parameters:

ParameterTypeDescription
columnDataColumnThe name of the column to return.

Returns: int - The index of the column specified by column if it is found; otherwise, -1.

indexOf(String columnName)

public int indexOf(String columnName)

Gets the index of the column with the specific name (the name is not case sensitive).

Parameters:

ParameterTypeDescription
columnNamejava.lang.StringThe name of the column to find.

Returns: int - The zero-based index of the column with the specified name, or -1 if the column does not exist in the collection.

iterator()

public Iterator iterator()

Returns: java.util.Iterator

remove(System.Data.DataColumn column)

public void remove(System.Data.DataColumn column)

Removes the specified DataColumn object from the collection.

Parameters:

ParameterTypeDescription
columnDataColumnThe DataColumn to remove.

remove(String name)

public void remove(String name)

Removes the DataColumn object that has the specified name from the collection.

Parameters:

ParameterTypeDescription
namejava.lang.StringThe name of the column to remove.