V
viepia
Hi,
I orignally had a SPROC rerturning @@Identiy, it usually works but sometimes it
doesn't. In my current project I verified with SQL Server Profiler that I was reading
@@Identity just after an Insert, but @@Identiy still returned null.
This SPROC appears to work every time:
ALTER PROCEDURE dbo.GetSysIdentity
@TableName VARCHAR(64),
@LastIdentity BIGINT OUTPUT
AS
BEGIN
SELECT @LastIdentity = IDENT_CURRENT(@TableName)
RETURN 0
END
Since I know the name of the SQL Table I am inserting to I can manually type the name:
long ? lastIdentity = 0;
Trace.Assert(db.GetSysIdentity("MyTable",ref lastIdentity)==0,"Bad SPROC");
Is there anywhere in LINQ where I can programmically find the Table Name? The Table
Name is shown in the <database>DataClasses.dbml diagram in the table's properties in the
Name and Source fields, how do I access these?
Thanks
Viepia
I orignally had a SPROC rerturning @@Identiy, it usually works but sometimes it
doesn't. In my current project I verified with SQL Server Profiler that I was reading
@@Identity just after an Insert, but @@Identiy still returned null.
This SPROC appears to work every time:
ALTER PROCEDURE dbo.GetSysIdentity
@TableName VARCHAR(64),
@LastIdentity BIGINT OUTPUT
AS
BEGIN
SELECT @LastIdentity = IDENT_CURRENT(@TableName)
RETURN 0
END
Since I know the name of the SQL Table I am inserting to I can manually type the name:
long ? lastIdentity = 0;
Trace.Assert(db.GetSysIdentity("MyTable",ref lastIdentity)==0,"Bad SPROC");
Is there anywhere in LINQ where I can programmically find the Table Name? The Table
Name is shown in the <database>DataClasses.dbml diagram in the table's properties in the
Name and Source fields, how do I access these?
Thanks
Viepia