insert rows, Access db, C#, Microsoft.Jet.OLEDB.4.0, autonumber =



I'm using C# and Microsoft.Jet.OLEDB.4.0 provider to insert rows into an
Access mdb.

It's a large legacy app, so I need to keep the db where it is, in Access.

The table has an autonumber column.

I insert the rows (not including the autonumber column, of course) but the
autonumber column is set to zero. I close my app and open the db in Access,
just to make sure it's not a caching problem.

I Googled the question and read all the articles I could find on this
subject. One suggested inserting -1 for the autonumber column, but this
didn't work. None of the other suggestions I could find worked.

I am using OleDbParameter's, not concatenating a big SQL text string.

I've tried the insert with and without a transaction. No difference.

Other than the autonumber column, the insert is working correctly. My code
is admin code for a larger app, so I need the autonumber column to be set
correctly.

How do I get this insert to work (i.e. set the autonumber column contents
correctly)?

Thanks very much in advance,

Adam Leffert
.


Loading