|
Tuesday, 31 January 2012 09:57 |
following code will add a datacolumn which automatically increments the value of the column for new rows added to the table
DataColumn newcolumn=new DataColumn("studentID", System.Type.GetType("System.Int32"));
newcolumn.AutoIncrement = true;
newcolumn.AutoIncrementSeed = 1;
newcolumn.AutoIncrementStep = 1;
//// Add column to datatable.
DataTable mytable=new DataTable();
mytable.Columns.Add(column);
 Read more: |