我自己在服务器端写了一个简单的存储过程如下:
create procedure long
 (@age int)
as
    select 姓名,性别,年龄,职业
      from login
           where 年龄=@age
return
我现在想在VB中调用该过程,怎么调用啊?帮帮我啊,
set cn=createobject("adodb.connection")
 cn.open "driver={sql server};server=local;database=system"
set fs=createobject("adodb.recordset")
下面调用我就不知道该怎么写了,望大虾帮帮忙,小弟急用

解决方案 »

  1.   

    Dim cmdProc As ADODB.Command
        Set cmdProc = New ADODB.Command    Set cmdProc.ActiveConnection = cn
        With cmdProc
            .CommandType = adCmdStoredProc
            .CommandText = strCmdText
            
                .Parameters(1).Direction = adParamInput
                .Parameters(1) = 1            .Parameters(2).Direction = adParamOutput
                '.Parameters(2) = 2
            Next
            .Parameters(0).Direction = adParamReturnValue
            
            Set rsResult = .Execute存储过程中要返回记录集要加入 SET NOCOUNT ON 语句
      

  2.   

    http://www.china-askpro.com/msg22/qa82.shtml
    http://www.china-askpro.com/msg35/qa37.shtml