System.Data.DataColumn.DefaultValue Property

Gets or sets the default value for the column when you are creating new rows.

Syntax

[System.ComponentModel.TypeConverter(typeof(System.Data.DefaultValueTypeConverter))]
public object DefaultValue { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

A default value is the value that is automatically assigned to the column when a System.Data.DataRow is created (for example, the date and time when the System.Data.DataRow was created.

When DataColumn.AutoIncrement is set to true, there can be no default value.

You can create a new row using the DataRow.ItemArray property of the System.Data.DataRow class and passing the method an array of values. This is a potential problem for a column with a default value because its value is generated automatically. To use the DataRow.ItemArray property with such a column, place null in the column's position in the array. For more information, see the DataRow.ItemArray property.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0