Comments/Troubleshooting

The commonly used public properties of the DataColumn class are listed in Table 24-1.

Table 24-1. DataColumn properties

Property

Description

AllowDBNull

Gets or sets whether null values can be stored in the column.

AutoIncrement

Gets or sets whether the column automatically increments with each new row added to the table.

AutoIncrementSeed

Gets or sets the amount that an automatically incrementing column is incremented each time a row is added to the table.

AutoIncrementStep

Gets or sets the starting value for an automatically incrementing column.

Caption

Gets or sets the caption for the column used as the default value for the Caption property in controls that support its display.

ColumnMapping

Gets or sets how column data is written when it is saved as XML.

ColumnName

Gets or sets the name of the column.

DataType

Gets or sets the data type of the column data as one of the .NET Framework data types.

DefaultValue

Gets or sets the value that is automatically assigned to the column when a new row is created.

Expression

Gets or sets an expression that calculates the value of the column.

MaxLength

Gets or sets the maximum length for a column with a text data type in characters.

Namespace

Gets or sets the XML namespace for the XML representation of the data stored in the column.

Ordinal

Gets the position of the column within the column collection of the table.

Prefix

Gets or sets the XML prefix for the XML representation ...

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.