我的存贮过程是这样的,想将 Count 的数据提取出来,检查语法时提示 "exple不是有效的列名"CREATE  procedure Count_Test@Count_out int OutputasSELECT COUNT(*) AS Exple FROM Table_Dslset @Count_out = expleGO请教大家这里错在那里啊?谢谢大家了!

解决方案 »

  1.   

    CREATE  procedure Count_Test@Count_out int OutputasSELECT @Count_out = COUNT(*) FROM Table_Dsl
    GO
      

  2.   

    Dim cmd As New ADODB.Command
        Dim par As New ADODB.Parameter
        cmd.ActiveConnection = cnDatabase
        cmd.CommandText = "count_test"
        cmd.CommandType = adCmdStoredProc
        Set par = cmd.CreateParameter("aa", adInteger, adParamOutput)
        cmd.Parameters.Append par
        cmd.Execute
        Debug.Print par.Value
      

  3.   

    其实如果仅仅是获得记录数没有必要用存储过程,这样即可
    rs.open "select count(*) as exp1 from table1",cn
    debug.print rs!exp1