This documentation is archived and is not being maintained.

DataColumn.AutoIncrementStep Property

Gets or sets the increment used by a column with its AutoIncrement property set to true.

[Visual Basic]
Public Property AutoIncrementStep As Long
public long AutoIncrementStep {get; set;}
public: __property __int64 get_AutoIncrementStep();
public: __property void set_AutoIncrementStep(__int64);
public function get AutoIncrementStep() : long;
public function set AutoIncrementStep(long);

Property Value

The number by which the value of the column is automatically incremented. The default is 1.


Exception Type Condition
ArgumentException The value set is zero.


[Visual Basic, C#, C++] The following example sets the AutoIncrement, AutoIncrementSeed, and AutoIncrementStep properties.

[Visual Basic] 
Private Sub AddAutoIncrementColumn()
    Dim myColumn As DataColumn = New DataColumn
    myColumn.DataType = System.Type.GetType("System.Int32")
    With MyColumn
       .AutoIncrement = True
       .AutoIncrementSeed = 1000
       .AutoIncrementStep = 10
    End With
    ' Add the column to a new DataTable.
    Dim myTable As DataTable
    myTable = New DataTable
 End Sub

private void AddAutoIncrementColumn(){
    DataColumn myColumn = new DataColumn();
    myColumn.DataType = System.Type.GetType("System.Int32");
    myColumn.AutoIncrement = true;
    myColumn.AutoIncrementSeed = 1000;
    myColumn.AutoIncrementStep = 10;
    // Add the column to a new DataTable.
    DataTable myTable = new DataTable("MyTable");

void AddAutoIncrementColumn(){
    DataColumn* myColumn = new DataColumn();
    myColumn->DataType = System::Type::GetType(S"System.Int32");
    myColumn->AutoIncrement = true;
    myColumn->AutoIncrementSeed = 1000;
    myColumn->AutoIncrementStep = 10;
    // Add the column to a new DataTable.
    DataTable* myTable = new DataTable(S"MyTable");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataColumn Class | DataColumn Members | System.Data Namespace | AutoIncrement | AutoIncrementSeed | Expression | ItemArray