Retrive Identity after insert while using Autonumber set to Replication ID

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?
 
M

Michael Lang

(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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top