Chapter 8. DataColumns

The DataColumn defines the schema for a single column in a DataTable. The DataTable schema is defined by a collection of columns in the table along with any constraints. The DataColumn defines:

  • The type of data that can be stored in the column

  • The length of the column for text-based column types

  • Whether the data in the column can be modified

  • Whether the column values for each row must be unique

  • Whether the column in rows can contain null values

  • Whether the column values are automatically generated and the rules for generating those values

  • Whether the column value is calculated based on an expression

As with all disconnected classes, the DataColumn is independent of the column in the underlying data source. As a result, its data type is defined as a .NET Framework data type that is matched to the data type in the data source.

Get ADO.NET in a Nutshell now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.