System.Data Namespace DataColumn Class
Sets or retrieves the starting value for a column that has its AutoIncrement property set to true.
Script |
DataColumn.AutoIncrementSeed [ = intValue ] |
The property is read/write with no default value.
The following example sets the AutoIncrement, AutoIncrementSeed, and AutoIncrementStep properties.
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" );
myTable.Columns.Add ( myColumn );
}
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 New DataTable ( "MyTable" )
myTable.Columns.Add ( myColumn )
End Sub |
|
C# |
VB |
DataColumn Members AutoIncrement AutoIncrementStep Expression ItemArray