c# and data navigator

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an access database dataset which a draggedonto a form which also put
the data navigator on the form. The problem is that when I ADD a new record
witht he add button, it gives me a primarykey that has already been used and
deleted before in the database. Then of course when you try to save it you
get an error because access won't allow this.

I do not undertand why this primarykey issue is happening? If I create a
new record in the access database itself, it operated correctly.

Any ideas?
 
Chris,

If it is an autoincrement ident, than the ID that is showed in your datarow
is not used at insert time.

Have a look at the seed properties from a column,

Cor
 
If the primary key is an autonumber field, set the seed and increment to -1
on the table adapter. It is incrementing forward, replacing those already
there. If set to -1, when it writes it to the database, it will assign the
appropriate number to it.

Robin S.
 
Thanks. How to set seed? is this a property of the table adapter?
Yes, it is an autonumber field in Access table.
 
In the data set designer, if you click on the autonumber column and look at
the properties, they are called autoincrementseed and autoincrementstep. I
think you need to set AutoIncrement to True, too.

Robin S.
----------------------------------------------------------
 
Back
Top