AutoIncrement Column on dataColumn

  • Thread starter Thread starter Gerry Viator
  • Start date Start date
G

Gerry Viator

Hi all,

Using a datatable and want to delete a datarow that has been added to
the datatable and reset the AutoIncrement column number. How do you
reset a column setup for AutoIncrement number? I can delete
the datarow and then call exceptchanges which works fine but, the
AutoIncrement number keeps
counting instead of backing up to before the deleted row or rows.

Please help

thanks
Gerry
 
I'd use Negative Numbers anyway so that you can avoid Identity collisions if
this moves into a multiuser environment. You can also specify the seed
value at any given time
 
Hi and thanks for your help,


I tried setting the seed after this and it doesn't work?

Dim Cnt As Integer = MainSavedDataTable.Rows.Count

Dim Row As DataRow = MainSavedDataTable.Rows(Cnt - 1)

Row.Delete()

MainSavedDataTable.AcceptChanges()

MainSavedDataTable.Columns(0).AutoIncrementSeed = 1

thanks

Gerry
 
Back
Top