u7c76
asked on
Accessing MS Access through VB.NET
I'm currently developing a VB.net win forms application. This application uses MS Access 2000 for the database. When inserting into a table, the primary key is an autonumber. Then I need to insert this autonumber into this other table. This autonumber is a foriegn key in this other table. Is there an easy way to get what the value of the autonumber of the table at the time of insert, or do I need to write a query to retrieve this value.
Thanks,
Brian
Thanks,
Brian
use @@identity
also you could use
SELECT Max(RecordID) as LastAutoID FROM Table1
to get the last ID inserted. But if you are using Access 200 or higher, I recomment using @@IDENTITY
SELECT Max(RecordID) as LastAutoID FROM Table1
to get the last ID inserted. But if you are using Access 200 or higher, I recomment using @@IDENTITY
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.