T
Timo
I have followed carefully the advice given in this forum on how to
handle autonumber primary keys in Access, setting AutoIncrement
properties on the column and negative seed number and negative
increment, as well as backfilling the pkcol in the onRowUpdated event.
But I keep getting an error that the value already exists; the weird
thing is, the value that already exists happens to be the PK value of
the PENULTIMATE row in the table, not counting the one I am trying to
add:
I'm invoking the Addnew method via the BindingManager.AddNew method.
and the BindingManager is instantiated like this:
MyBindingManager = myEditControl.BindingContext(MyDataView)
Looking at the table in Access datasheet mode, I see
ID
1000
..
.. many other rows here
..
3231 <-- penultimate row
3232
***************
Error message:
Column 'ID' is constrained to be unique. Value '3231' already exists.
*******************************************************************
I don't understand what is going on. I'm using the DatAdapter
(Table).Update method. Here is how the adapter is instantiated:
AnAdapter = New System.Data.OleDb.OleDbDataAdapter(Table, Connection)
AnAdapter.FillSchema(MyDataset, SchemaType.Source, Tablename)
AnAdapter.Fill(MyDataset, Tablename)
Is the SchemaType an issue?
en una selva oscura,
Timo
handle autonumber primary keys in Access, setting AutoIncrement
properties on the column and negative seed number and negative
increment, as well as backfilling the pkcol in the onRowUpdated event.
But I keep getting an error that the value already exists; the weird
thing is, the value that already exists happens to be the PK value of
the PENULTIMATE row in the table, not counting the one I am trying to
add:
I'm invoking the Addnew method via the BindingManager.AddNew method.
and the BindingManager is instantiated like this:
MyBindingManager = myEditControl.BindingContext(MyDataView)
Looking at the table in Access datasheet mode, I see
ID
1000
..
.. many other rows here
..
3231 <-- penultimate row
3232
***************
Error message:
Column 'ID' is constrained to be unique. Value '3231' already exists.
*******************************************************************
I don't understand what is going on. I'm using the DatAdapter
(Table).Update method. Here is how the adapter is instantiated:
AnAdapter = New System.Data.OleDb.OleDbDataAdapter(Table, Connection)
AnAdapter.FillSchema(MyDataset, SchemaType.Source, Tablename)
AnAdapter.Fill(MyDataset, Tablename)
Is the SchemaType an issue?
en una selva oscura,
Timo