CREATE PROCEDURE Up_MakeMaintainPreNotify
@LastMaintainDate datetime,    --上次保养日期
 @aaa int output
as
...

解决方案 »

  1.   

    private sub 
    dim inSN as string '假定你用的序列号为字符串
    dim outRet as long '假定你用的返值为整型
    dim cnn as new connection
    dim cmd as new command
    dim param1 as new parameter
    dim param2 as new parameteron error goto Err
    //建立数据库连接
    cnn.connectionstring=你要的连接串
    cnn.open
    set cmd.activeconnection=cnn
    //设置命令对象
    cmd.commandtype=adcmdstoredprocedure
    cmd.commandtext=你写的存储过程名
    //添加参数对象
    set param1=cmd.createparameter("insn",advarchar,adparaminput,50,inSN)
    set param2=cmd.createparameter("RetVal",adinteger,adparamoutput)
    cmd.parameters.append param1
    cmd.parameters.append param2
    //执行之
    cmd.execute
    //得到结果  OutRet=clng(param2) '得到你想要的返回值exit sub
    Err:
      msgbox err.number & err.descrpition
    end sub
      

  2.   

    CREATE PROCEDURE Up_MakeMaintainPreNotify
    @LastMaintainDate datetime,    --上次保养日期
     @aaa int output
    as
    ...
     
    调用:
    rs.Open "declare @a int  exec Up_MakeMaintainPreNotify '" + CStr(DTPicker1.Value) + "',@a output Select @a ",Connmsgbox rs.fields(0)
      

  3.   

    关键是我没有用上面的command,recordset等这些,我只有conn来打开而以!
    有办法吗??
      

  4.   

    1:只用连接是不可能得到返回值的。
    2:
    编号: 356 发送者 put2001_ruan 发送时间 2003-10-27 10:30:28 删除  回复  
    内容 Rs.Open "declare @a varchar(10) exec Up_MakeRepairPreCall '" + CStr(DTPicker1.Value) + "','"+text1.text+"'", Conn
    MsgBox Rs.Fields(0).ValueCREATE PROCEDURE Up_MakeMaintainPreNotify
    @LastMaintainDate datetime,          --上次保养日期
    @aaa varchar(10) output
    as
    ...出现错误:没有该集合! 
    dim rs as new adodb.recordset
    ...
    Rs.Open "declare @a varchar(10) exec Up_MakeRepairPreCall '" + CStr(DTPicker1.Value) + "',@a output select @a ", Conn
    MsgBox Rs.Fields(0).Value
      

  5.   

    没有问题:
    dim ints as integerrs.open "Up_MakeRepairPreCall '" & CStr(DTPicker1.Value) & "','"&ints+&"'"
    调用ints