请大家介绍一下c#调用存储过程

解决方案 »

  1.   

     SqlCommand cmd = new SqlCommand(sql,con);
                cmd.CommandText = "存储过程名";
                cmd.Parameters = "参数名";
    应该是这样吧。记得不太清楚咯。。
      

  2.   

    最简单的存储过程调用是用强类型的DataSet,
    和一般的对表的访问没什么两样!!
      

  3.   

    SqlCommand cmd = new SqlCommand(sql,con); 
                cmd.CommandText = "存储过程名"; 
    cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters = "参数名"; 
      

  4.   

    看看sqlhelper
    using(SqlConnection conn=new SqlConnection(""))
    {
            SqlCommand cmd = new SqlCommand("",conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@a",SqlDbType.VarChar);
            cmd.Parameters["@a"].Value = userName.Text.ToString();
         
            cmd.Parameters.Add("@b",SqlDbType.Int);
            cmd.Parameters["@b"].Direction = ParameterDirection.Output;
            conn.Open();
            cmd.ExecuteNonQuery();conn.Close();
    }
    http://topic.csdn.net/u/20080630/22/d46db0bc-1a9d-40f7-aee5-e4afc70df4d7.html