标签: enterprise-library-4.1

从存储过程返回最后一个插入行的标识

我试图从存储过程返回最后插入行的标识.

我的代码的简化版本如下所示:

CREATE PROCEDURE [sp_name]
    @AuthorisationCode uniqueidentifier
AS
    INSERT INTO [tablename]
           ([AuthorisationCode]
           )
     VALUES
           (@AuthorisationCode
           )

 RETURN @@IDENTITY

GO
Run Code Online (Sandbox Code Playgroud)

我通过Enterprise Library 4.1中的Execute Scalar调用此存储过程.

它返回null.有人看到我做错了什么.

c# sql enterprise-library sql-server-2008 enterprise-library-4.1

4
推荐指数
2
解决办法
2万
查看次数