想这种我的做法是定义一个返回值 @intback int outputCREATE PROCEDURE  jady_LogOn
@ID int,
@Password char(15)
@intback int output
AS
declare @pw char(15)
select @pw=Pwd from tablename where QQ_ID=@ID
if(@Password=@pw)
begin
--insert tablename………………
set @intback=1

end
else
begin
set @intback=5
end
GO

解决方案 »

  1.   

    --改一下存储过程
    CREATE PROCEDURE  jady_LogOn
    @ID int,
    @Password char(15),
    @re int output
    AS
    declare @pw char(15)
    select @pw=Pwd from tablename where QQ_ID=@ID
    if(@Password=@pw)
    begin
    --insert tablename………………
    set @re=1

    end
    else
    begin
    set @re=5
    end
    GO
    --用ADO调用,VB中的写法:
    dim icmd as new adodb.command
    With iCmd
        .ActiveConnection = 数据库连接字符串
        .CommandType = adCmdStoredProc
        .CommandText = "jady_LogOn"
        .Parameters.Refresh
        .Parameters("@id")=1
        .Parameters("@password")="1"
        .Execute
        msgbox "返回结果:" & .Parameters("@re")
    End With
      

  2.   

    set @re=5是不行的,我开始久是这样鞋的。我用的是VC的ADO,自己写的。
    我现在只好注释掉insert语句,set好output值后再单独调一个insert过程。
      

  3.   

    还有个更棘手的问题大家看一下把
    http://expert.csdn.net/Expert/topic/2431/2431932.xml?temp=.1976282