seehttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingstoredprocedureswithcommand.asp

解决方案 »

  1.   

    Dim workflowcommand As New SqlCommand()
    workflowcommand.CommandText = "GetPendWorkFlowFile1"
    workflowcommand.CommandType = CommandType.StoredProcedure
    其中GetPendWorkFlowFile1是存储过程。如果有参数再加下面的语名
    workflowcommand.Parameters.Add("@userid", SqlDbType.Int)
    workflowcommand.Parameters("@userid").Value = userid
    @userid是存储过程需要的参数。
      

  2.   

    http://www.c-sharpcorner.com/Code/2003/Jan/InsOutsinCS.asp
      

  3.   

    ..
    Parm = cmd.Parameters.Add("@OutputParm", OleDbType.VarChar, 28);
    Parm.Direction = ParameterDirection.Output;SqlDataReader rs = cmd.ExecuteReader();
    sting sTemp=cmd.Parameters["@OutputParm"].Value;
      

  4.   

    大家可能误会我的意思了, 我存储过程中并未定义输出参数,仅仅是根据操作结果用return 0 和return 1返回,我现在就是想取到这个返回的0或者1
      

  5.   

    用这个试试:
    vCommand.Parameters.Add("RETURN_VALUE", SqlDbType.Int);
    vCommand.Parameters["RETURN_VALUE"].Direction = ParameterDirection.ReturnValue;
    ...SqlDataReader dr = vCommand.ExecuteReader();
    int ans = int.Parse(vCommand.Parameters["RETURN_VALUE"].Value.ToString());
    ...
      

  6.   

    定义
    SqlParameter sampParm = sampleCMD.Parameters.Add("RETURN_VALUE", SqlDbType.Int);
    sampParm.Direction = ParameterDirection.ReturnValue;
    取值
    sampleCMD.Parameters["RETURN_VALUE"].Value