存储过程:
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)。

解决方案 »

  1.   

    @RETURN_VALUE = 1
    这个值哪里来的?
      

  2.   

    建立过程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
    end
    else
    begin
      set
      @Return=1
    end
    执行过程declare @re int 
    exec ProTest @UserID='1',@Password='', @Return=@re output 
      

  3.   

    没怎么看懂,也没出错啊,还有你没有给@return赋值,在else模块中
      

  4.   

    感觉你里面的@count  参数
    是个摆设 。
      

  5.   


    是啊,直接调用系统变量@@rowcount就行了