我有一个存储过程
ALTER PROCEDURE [dbo].[customers_iu] (@intId as int, @strName as nvarchar(100), @strSname as nvarchar(100),@intInsupdt as int = 0, @intGnrtdid as int OUTPUT)
AS
BEGIN
SET NOCOUNT ON;
if @intInsupdt = 1
begin
insert into dbo.customers (cust_Name, cust_Sname, cust_Tinno) values (@strName, @strSname,@strTinno)
set @intGnrtdid = (select ident_Current('dbo.customers'))
end
else if @intInsupdt = 0
begin
update dbo.customers set cust_Name = @strName, cust_Tinno = @strTinno where cust_Id = @intId ;
set @intGnrtdid = @intId
end
END
我想在使用 LINQ 时将@intGnrtdid
值获取到 int 变量。
参见 Scott Guthrie 关于 Linq to SQL 的优秀博客系列。第 6 部分介绍如何调用存储过程。从代码调用强类型存储过程时,out 参数仅由 ref
参数表示。