即返回参数形式是output的值

解决方案 »

  1.   

    SqlConnection myConnection=new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
    SqlCommand myCommand =new SqlCommand("sysEmpLogin",myConnection);
    myCommand.CommandType=CommandType.StoredProcedure;
    myCommand.Parameters.Add("@loginid",loginid);
    myCommand.Parameters.Add("@password",password);

    myCommand.Parameters.Add("@empid",SqlDbType.Int,4);
    myCommand.Parameters["@empid"].Direction=ParameterDirection.Output; myCommand.Parameters.Add("@reason",SqlDbType.VarChar,50);
    myCommand.Parameters["@reason"].Direction=ParameterDirection.Output;
    myCommand.Parameters.Add("@purview",SqlDbType.Char,2);
    myCommand.Parameters["@purview"].Direction=ParameterDirection.Output;
    myConnection.Open();
    myCommand.ExecuteNonQuery();
    myConnection.Close(); string LoginID=myCommand.Parameters["@empid"].Value.ToString();
    string Result="";
    string pur=myCommand.Parameters["@purview"].Value.ToString();
      

  2.   

    我说的是在sqlHelper类中实现返回的功能,你这种是直接在类的外部写的啊
      

  3.   

    SqlHelper没有实现。
    再说你也可以自己写哈。我就不喜欢用SqlHelper,觉得封装的还是不够,所以调用存储过程我都用我自己的一个封装了存储过程的类。
      

  4.   

    SqlParameter TextOutParam = new SqlParameter("@ContentText", SqlDbType.NVarChar,120);
    TextOutParam.Direction = ParameterDirection.Output;
    SqlHelper.ExecuteNonQuery(PHSCenterConnString , CommandType.StoredProcedure 
    , "up_ssp_GetContentByRandomType"
    , new SqlParameter("@QuerySql" , querySql)
    , new SqlParameter("@OperateParam" ,operateParam)
    , TextOutParam  );
    if (TextOutParam.Value!=null)
    MtContent=TextOutParam.Value.ToString();
    if (MtContent.Length!=0)
    ContentCount=10000;
    return ContentCount;