Retrive Identity after insert while using Autonumber set to Replication ID

  • Thread starter Thread starter Jen
  • Start date Start date
J

Jen

I was hoping that someone could help me out with this. I am using an
access database and I have a table with an autonumber column. I have
this autonumber column set to Long Integer and after the insert i used
SELECT @@Identity to retrieve the id of the record that was inserted.
However, I now need to use GUIDs so I set the Autonumber to
Replication ID but the SELECT @@Identity will not return the ID now.

Does anyone have any suggestions?
 
(e-mail address removed) (Jen) wrote in @posting.google.com:
I was hoping that someone could help me out with this. I am using an
access database and I have a table with an autonumber column. I have
this autonumber column set to Long Integer and after the insert i used
SELECT @@Identity to retrieve the id of the record that was inserted.
However, I now need to use GUIDs so I set the Autonumber to
Replication ID but the SELECT @@Identity will not return the ID now.

Does anyone have any suggestions?

Why have the db autoNumber a guid? just assign a new guid in your
application, and just tell the DB what the records ID will be. Guid's are
uniquely generated in .NET using:

Guid.NewGuid()

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/colcodegen (simple code generator)
http://sourceforge.net/projects/dbobjecter (database app code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)
 
Back
Top