存储过程:
ALTER proc User_Login_1
@UserID nchar(10),
@Password char(20),
@Return int=1 output
as
declare @count int
select @count=count(*) from [table] where name= @UserID and password=@Password
if @count<1
begin
set
@Return=0
return @Return
end
else
begin
return @Return
end调试了一下,为什么会出现这种情况呢(线程 'pc2011030516val [56]' (0xc4c) 已退出,返回值为 0 (0x0)。
程序“[2440] [SQL] pc2011030516val: pc2011030516val”已退出,返回值为 0 (0x0)?)
@Return = 1
@RETURN_VALUE = 1
完成 [dbo].[User_Login_1] 运行。
线程 'pc2011030516val [56]' (0xc4c) 已退出,返回值为 0 (0x0)。
程序“[2440] [SQL] pc2011030516val: pc2011030516val”已退出,返回值为 0 (0x0)。
ALTER proc User_Login_1
@UserID nchar(10),
@Password char(20),
@Return int=1 output
as
declare @count int
select @count=count(*) from [table] where name= @UserID and password=@Password
if @count<1
begin
set
@Return=0
return @Return
end
else
begin
return @Return
end调试了一下,为什么会出现这种情况呢(线程 'pc2011030516val [56]' (0xc4c) 已退出,返回值为 0 (0x0)。
程序“[2440] [SQL] pc2011030516val: pc2011030516val”已退出,返回值为 0 (0x0)?)
@Return = 1
@RETURN_VALUE = 1
完成 [dbo].[User_Login_1] 运行。
线程 'pc2011030516val [56]' (0xc4c) 已退出,返回值为 0 (0x0)。
程序“[2440] [SQL] pc2011030516val: pc2011030516val”已退出,返回值为 0 (0x0)。
这个值哪里来的?
@UserID nchar(10),
@Password char(20),
@Return int=1 output
as
declare @count int
select @count=count(*) from [table] where name= @UserID and password=@Password
if @count<1
begin
set
@Return=0
end
else
begin
set
@Return=1
end
执行过程declare @re int
exec ProTest @UserID='1',@Password='', @Return=@re output
是个摆设 。
是啊,直接调用系统变量@@rowcount就行了