In Access the @@IDENTITY is the identity from last table you updated on your
connection.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
I think I understand most of that, except for one thing:
When executing the command, how does it know what table to get it from? I
have multiple tables in my DB, and different tables have different numbers
of records. How does it know which table to get the last value from?
Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Nathan,
What you need to do directly after an update or insert is
dim cmd as New OleDbCommand("SELECT @@IDENTITY", conn)
dim mylastId = cmd.executescalar
I hope this helps,
Cor
"Nathan Sokalski" <nj********@hotmail.com> schreef in bericht
news:ec**************@TK2MSFTNGP12.phx.gbl...I am using ASP.NET to insert records into a Microsoft Access Database. My
primary keys are of type Autonumber. However, because some of the tables
have relationships I need to know the value of the Autonumber field when
I use the Insert command so that I can put it in the foreign key field of
other tables. I am using VB.NET to code my ASP.NET application. How can I
do this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/