Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Autoincrement / Rowstate problems

Thread Tools

Autoincrement / Rowstate problems

Posts: n/a

I'm getting some strange results using the autoincrement column on my
datatable. I'm populating a datatable with data from my database and
displaying this in a datagrid. The first time I get the data from the
database I create a new table with an autoincrement column bind the datagrid
to this new table. The auto increment column is displayed as an ID col in the
datagrid. The user can add records or modify records at this point, when the
user adds records i create a new row in the datatable and rebind the grid,
this all works fine and the autoincrement displays the next number in the ID
col. However if I make a change to the original rows that come back from the
database and then add a new record the autoincrement starts to skip numbers.
It looks like the datatable creates a copy of the original data before
modifying it but the autoincrement col is generated in between this
happening. I have verifed that it is something to do with the rowstate
because if I call AcceptChanges() and then re-generate the auto id it works
fine but I need to know the rowstate to perform my updates so I cannot use
this as a workaround.

Sorry for the long post but if anyone has any ideas pls let me know.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
RowState how to check it ? Jarod ASP .Net 0 06-06-2006 06:19 PM
q; DataSet RowState unchanged =?Utf-8?B?SklNLkgu?= ASP .Net 1 05-24-2006 09:41 PM
To get the total no[count] of rows in a daatable with rowstate deleted thomson ASP .Net 1 06-11-2005 02:03 PM
About Rowstate and AutoIncrement fatboycanteen ASP .Net 0 12-12-2003 02:56 AM
Re: ViewState + AutoIncrement -- Okay; Session + AutoIncrement -- Not okay Gene Gorokhovsky ASP .Net 0 07-17-2003 02:48 PM