Access 97 - getting Autonumber

  • Thread starter Thread starter Justin Weinberg
  • Start date Start date
J

Justin Weinberg

I thought I'd share my epiphany.

We have a client who is set on Access 97 for the time being. We can't
change that, nor the DB structure, since the rest of their architecture uses
it. The problem is getting the autonumber of an inserted record in ADO.NET.
It's a little clugee and violates ACID, but it's MS Access 97 anyway.

Insert a GUID into one of your string columns for the record and Select
where column=GUID. Rewrite insert queries as updates. This doesn't work
for tables without string columns of course.

Cute, huh?

--
Justin Weinberg

Designing a PrintDocument or creating .NET graphics?
Save time with GDI+ Architect.
For more information, visit http://www.mrgsoft.com
 
Hi Justin,

You have to had all other columns null allowed, right?

Theoretical alternative would be to generate numbers by yourself (use normal
number column instead of autonumber) - you might put the last number used in
a special table.
Of course, if dropping autonumbering is posible choice.
 
Yes, I wish I could change the structure of the tables. Unfortunately on
this project, that's not possible.
 
Back
Top