Handling AutoNumbers in Access Database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Finn Stampe Mikkelsen

    Handling AutoNumbers in Access Database

    Hi

    I've several times run into to the following event...

    I've designed a database, using access and Autonumber type field as the
    primary key.

    I use DataGridViews with bindingsources and Bindingnavigato rs to navigate
    around the data. When i insert a new record into the database, i do not
    supply this number, then update the tableadapter and the data is displayed
    in the DataGridView (DGV)... But...

    The DGV does not have the ID (Autonumber field) set, displays at -1, and
    trying to edit these records and updating them results in an error with 0 of
    1 records updated... This ofcourse being because the PrimaryKey field is set
    to -1

    Is there any way, besides actually to clear and refill the dataset, to make
    sure that this field is updated with the assigned ID (Autonumber) / key??

    /Finn


Working...