To understand a data table, you must first understand data rows and data columns. The DataColumnCollection type returns a collection of columns that can be accessed through Columns property of the DataTable. The DataColumnCollection object represents a collection of columns attached to a data table. You add a data column to the DataColumnCollection using its Add method. The DataColumn object represents a column of a DataTable. For example, say you want to create a customers table that consists of three columns: ID, Address, and Name. You create three DataColumn objects and these columns to the DataColumnCollection using the DataTable.Column.Add method.After creating a data table schema, the next step is to add data to the data table by using the DataRow object. The DataColumn has some properties. These properties describe a column, such as its uniqueness, what kind of data you can store in that column, default value, caption, name, and so on. Below Table describes some of the DataColumn class members.Table: The DataColumn class properties
PROPERTY
DESCRIPITION
AllowDBNull
Both read and write, represent if column can store null values or not
AutoIncrement
Represent if column's value is auto increment or not
AutoIncrementSeed
Starting value of auto increment, applicable when AutoIncrement is true
AutoIncrementStep
Indicates the increment value
Caption
Caption of the column
ColumnMapping
Represent the MappingType of the column
ColumnName
Name of the column
DataType
Data type stored by the column
DefaultValue
Default value of the column
Expression
Represents the expression used to filter rows, calculate values, and so on
MaxLength
Represents maximum length of a text column
ReadOnly
Represents if a column is read-only or not
Unique
Indicates whether the values in a column must be unique or not
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: