Monday, January 31, 2005

Auto Increment Column In DataTable

DataColumn objDataColumn = new DataColumn();
objDataColumn.ColumnName = "AutoColumn";
objDataColumn.AutoIncrement = true;
objDataColumn.AutoIncrementSeed = 1;
objDataColumn.AutoIncrementStep = 1;

objDataTable.Columns.Add(objDataColumn);

1 comment:

Hammad said...

This is how you can create a DataColumn that has an auto-increment column!