System.Data Namespace DataColumnCollection Class
Returns the DataColumn from the collection with the specified name.
DataColumn variable = DataColumnCollection.Item [ name ];
... or ...
DataColumn variable = DataColumnCollection [ name ];
dim variable as DataColumn = DataColumnCollection.Item ( name )
... or ...
dim variable as DataColumn = DataColumnCollection ( name )
variable : DataColumn = DataColumnCollection.Item ( name );
... or ...
variable : DataColumn = DataColumnCollection ( name ); |
|
C# |
VB |
JScript |
- name
- The name of the column to return.
The DataColumn in the collection with the specified ColumnName.
The Item property is not case-sensitive when searching for column names.
The following example uses the Item property to print the DataType value of a DataColumn object specified by name.
private void PrintDataType ( DataTable dt ) {
// get the DataColumnCollection from a DataTable in a DataSet.
DataColumnCollection cols = dt.Columns;
// print the column's data type.
Response.Write ( cols [ "Totals" ].DataType );
}
DataColumnCollection Members DataColumnCollection.Item Overload List ColumnName Contains DataColumn