access @@IDENTIY in LINQ?

  • Thread starter Thread starter viepia
  • Start date Start date
V

viepia

Hi,
The ony unique identifier for each row of my table is an
auto-increment BigInt Identity column. After I do a InsertOnSubmit
and a SubmitChanges how do I find the Identity column value for the
row I just inserted? In general how does LINQ expose the SQL Server
global variables?
Thanks,
Viepia
 
I don't know if this is the best way, but for now this SPROC works for
me:

ALTER PROCEDURE getSysIdentity
@LastIdentity BIGINT OUTPUT
AS
BEGIN
SELECT @LastIdentity = @@IDENTITY
RETURN 0
END


long? identity = 0;
Trace.Assert( db.getSysIdentity(ref
identity)==0,"SPROC Error");
 

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

Back
Top