Connecting Tech Pros Worldwide Forums | Help | Site Map

Retrieving Autonumber

DickChristoph
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi

I am wondering how to retrieve the last autonumber added to an Access Table.

Or more importantly, If I do an insert to a table which has an autonumber
field, How do I retrieve the auto-number for the data I just added?

Something like "Set @NewValue = @@Identity" in sql server.

I will be inserting the data through an ADO.Net OleDB command object in a
VB.Net program, the Access XP program will not be running.

TIA

-Dick Christoph
dchristo@mn.rr.com



Steve Jorgensen
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Retrieving Autonumber


I think ADO.Net works the same as ADO. That is, after you update a record via
a recordset, you can then retrieve use a special argument to Find to move to
the row just added, then just read the value from the autonumber field.

On Mon, 08 Aug 2005 00:39:34 GMT, "DickChristoph" <dchristo101@yahoo.com>
wrote:
[color=blue]
>Hi
>
>I am wondering how to retrieve the last autonumber added to an Access Table.
>
>Or more importantly, If I do an insert to a table which has an autonumber
>field, How do I retrieve the auto-number for the data I just added?
>
>Something like "Set @NewValue = @@Identity" in sql server.
>
>I will be inserting the data through an ADO.Net OleDB command object in a
>VB.Net program, the Access XP program will not be running.
>
>TIA
>
>-Dick Christoph
>dchristo@mn.rr.com
>[/color]

David W. Fenton
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Retrieving Autonumber


"DickChristoph" <dchristo101@yahoo.com> wrote in
news:aRxJe.1137$32.248@tornado.rdc-kc.rr.com:
[color=blue]
> I will be inserting the data through an ADO.Net OleDB command
> object in a VB.Net program, the Access XP program will not be
> running.[/color]

Well, then, comp.databases.ms-access is a very strange choice for
posting the question, no?

Your question clearly has absolutely zilch to do with Access, as a
matter of fact. It's a Jet/ADO.NET question, and, while Jet is the
default db engine of the program Access, ADO.NET is not an interface
that users of Access can use to manipulate Jet data.

I truly wish more people would maintain the distinction between
Access and Jet. I know, I know, it's a losing battle because
Microsoft themselves don't maintain the distinction clearly.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Closed Thread