asp.net.ph

DataColumn.AutoIncrementStep Property

System.Data Namespace   DataColumn Class


Sets or retrieves the increment used by a column with its AutoIncrement property set to true.

Syntax


Script DataColumn.AutoIncrementStep = intValue

Possible Values


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

The property is read/write with a default value of 1.

Exceptions


Exception Type Condition
ArgumentException Occurs when the value set is zero.

Example

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 );
}
  C# VB

See Also

DataColumn Members   AutoIncrement   AutoIncrementSeed   Expression   ItemArray Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 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 asp.net.ph