Question Problem with AutoIncrement

dnate

New member
Joined
Jan 11, 2011
Messages
2
Programming Experience
Beginner
Hi

I have 2 tables - say Order and OrderDetail. For both tables, I have primarykey as Id and both are AutoIncrement.

I am adding new record to Order and OrderDetail using bindingsource.addNew()

I try to display the 'Id's for both the table it shows -1. Anyways I really dont need to show it.

But when I want to refer to 'Id' at later stage in the form, I still get -1. How do I get the Id which is 'AutoIncrement'ed from the database.

FYI - I am using Access 2007 and VB Express 2008

thanks in advcance
 
This is one of the issues with using Access. In SQL Server, you can refresh the DataSet automatically with auto-generated values when you save new records. With Access you can't. You have to re-query the database separately.
 
Back
Top