Autoincrement / Rowstate problems

Discussion in 'ASP .Net' started by =?Utf-8?B?TmVpbA==?=, Oct 15, 2004.

  1. Hi,

    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.

    Thanks
    N
    =?Utf-8?B?TmVpbA==?=, Oct 15, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gene Gorokhovsky
    Replies:
    0
    Views:
    455
    Gene Gorokhovsky
    Jul 17, 2003
  2. fatboycanteen

    About Rowstate and AutoIncrement

    fatboycanteen, Dec 12, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    314
    fatboycanteen
    Dec 12, 2003
  3. thomson
    Replies:
    1
    Views:
    792
    Brock Allen
    Jun 11, 2005
  4. =?Utf-8?B?SklNLkgu?=

    q; DataSet RowState unchanged

    =?Utf-8?B?SklNLkgu?=, May 24, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,061
    =?Utf-8?B?SklNLkgu?=
    May 24, 2006
  5. Jarod

    RowState how to check it ?

    Jarod, Jun 6, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,101
    Jarod
    Jun 6, 2006
Loading...

Share This Page