不知道你想得到的返回参数是什么?如果@myretID是返回参数,存储过程应该这样写:
CREATE PROCEDURE [insID_myDBinstall] (@myretID [varchar](10) out) 
AS 
select @myretid = count(*) from myid

解决方案 »

  1.   

    在vb中这样写试试看:Dim cn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    With cn
      .CursorLocation = adUseClient
      .Open "Provider=SQLOLEDB;Server=" + ServerName + ";Database=myinvoice;Uid=" + ServerID + ";Pwd=" + ServerPassword + ";"   
    End With
    With cmd
       .ActiveConnection = Cn
       .CommandType = adCmdStoredProc
       .CommandText = "insID_mydbinstall"
       .Execute
       Result = .Parameters("@myretID")   '得到返回参数
    End With
      

  2.   

    谢谢cn.Execute "insID_mydbinstall ...."
    我该如何得到返回的参数呢?
      

  3.   

    Dim cn As New ADODB.Connection
    Dim cmd As New ADODB.Command
    With cn
      .CursorLocation = adUseClient
      .Open "Provider=SQLOLEDB;Server=" + ServerName + ";Database=myinvoice;Uid=" + ServerID + ";Pwd=" + ServerPassword + ";"   
    End With
    With cmd
       .ActiveConnection = Cn
       .CommandType = adCmdStoredProc
       .CommandText = "insID_mydbinstall"
    '错误提示:过程需要参数,但未提供
       .Execute
       Result = .Parameters("@myretID")   '得到返回参数
    End With
      

  4.   

    那这样写试一试:
    With cmd
       .ActiveConnection = Cn
       .CommandType = adCmdStoredProc
       .CommandText = "insID_mydbinstall"
       .Parameters("@myretID") = ""       '加上这一句
       .Execute
       Result = .Parameters("@myretID")   '得到返回参数
    End With
      

  5.   

    别的不说,你的存储过程中的@SQL没用呀。
      

  6.   

    对于SQL SERVER 你的存储过程如下面这样就可以了。
    CREATE PROCEDURE  insID_myDBinstall  
    AS 
     select myretid = count(*)  from myid
     
       至于调用则:

    .Execute "exec  insID_myDBinstall "
      

  7.   

    在ASP中调用SQL存储过程  
    <% Set Comm=server.CreateObject 
    ("ADODB.Command") %> 
    <% Set Comm.ActiveConnection=conn %> 
    <% Comm.CommandType=adCmdStoredProc %> 
    <% Comm.CommandText="RegisterUser" %> 
    //创建存储过程返回参数对象 
    <% Set RetCode=Comm.CreateParameter 
    ("RetCode",adInteger,adParamReturnValue) %>  
    //创建存储过程输入参数对象 
    <% Set usrName=Comm.CreateParameter 
    ("usrName",adVarchar,adParamInput,30) %>  
    <% Set usrPwd=Comm.CreateParameter 
    ("usrPasswd",adVarchar,adParamInput,30) %> 
    <% Set age=Comm.CreateParameter("age",adInteger,adParamInput) %> 
    <% Set PhoneNum=Comm.CreateParameter 
    ("PhoneNum",adVarchar,adParamInput, 20) %> 
    <% Set Address=Comm.CreateParameter("Address",adVarchar,adParamInput,50) %> 
    <% Comm.Parameters.Append usrName %> 
    <% Comm.Parameters.Append usrPwd %> 
    <% Comm.Parameters.Append age %> 
    <% Comm.Parameters.Append PhoneNum %> 
    <% Comm.Parameters.Append Address %> 
    <% Comm.Parameters("usrName")=request 
    ("usrName") %> 
    <% Comm.Parameters("usrPasswd")=request 
    ("usrPasswd") %> 
    <% Comm.Parameters("age")=request("age") %> 
    <% Comm.Parameters("PhoneNum")=request 
    ("PhoneNum") %> 
    <% Comm.Parameters("Address")=request 
    ("Address") %> 
    <% Comm.Execute %> 
      

  8.   

    或者:
     dim myid as string 
     Call rst1.Open("exec  insID_myDBinstall ", cn, adOpenKeyset, adLockReadOnly)
     myid = cstr(rst1.fields(0).value)
      

  9.   

    或者:
    create  procedure insID_myDBinstall
        @myretID int  = 0 out
    as
        select @myretID = count(*) from myid
      
     再通过hycao(海草)的方法取得返回参数