DataColumn.AutoIncrement Property
Assembly: System.Data (in system.data.dll)
/** @property */ public boolean get_AutoIncrement () /** @property */ public void set_AutoIncrement (boolean value)
public function get AutoIncrement () : boolean public function set AutoIncrement (value : boolean)
Property Value
true if the value of the column increments automatically; otherwise, false. The default is false.If the type of this column is not Int16, Int32, or Int64 when this property is set, the DataType property is coerced to Int32. An exception is generated if this is a computed column. The Expression property is set. The incremented value is used only if the row's value for this column, when added to the columns collection, is equal to the default value.
You can create a new row using the ItemArray property of the DataRow class and passing in an array of values. This is a potential problem for a column with its AutoIncrement set to true, because its value is generated automatically. To use the ItemArray property, place a null reference (Nothing in Visual Basic) in the column's position in the array. For more information, see the ItemArray property of the DataRow class.
The following example sets the AutoIncrement, AutoIncrementSeed, and AutoIncrementStep properties.
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.