| |||||||||||||||
DataColumn.DefaultValue PropertySystem.Data Namespace DataColumn Class Sets or retrieves the default value for the column when creating new rows. Syntax
Property Value
The property is read/write with no default value. Exceptions
RemarksA default value is the value that is automatically assigned to the column when a DataRow is created. By setting a default value, you can give the user an idea of what information to input. On the other hand, you can use the DefaultValue property to automatically insert a value that shouldn't be touched by the user; for example, the current date and time of the row's creation. When AutoIncrement is set to true, there can be no default value. You can create a new row using the DataRow class's ItemArray property 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 ItemArray property with such a column, place a null reference in the column's position in the array. For more details, see the ItemArray property. ExampleThe following example initializes several DataColumn objects with different data types, and sets appropriate default values to each column.
See AlsoDataColumn Members DataType ItemArray AutoIncrement UniqueConstraint |
| ||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note
You can help support aspxtreme