title: move some data from excel to sql
body: <p>I want to move some data from an Excelfile to my database. I use c#
  this is my code:</p>
  
  <pre><code>        //conecting to DB
          SqlConnection sqlcon = new SqlConnection("Data Source=.;Initial Catalog=ghalamchi;Integrated Security=True");
          SqlCommand SqlCmd = new SqlCommand();
          SqlCmd.Connection = sqlcon;
          SqlCmd.CommandType = CommandType.StoredProcedure;
          SqlCmd.CommandText = "SP_AddStudent";
  
          int counter = 0;
  
           int i = 21;
          {
              SqlCmd.Parameters.Add("@id", SqlDbType.Char, 20).Value = Ds.Tables[0].Rows[i][0].ToString();
              SqlCmd.Parameters.Add("@name", SqlDbType.NVarChar, 50).Value = Ds.Tables[0].Rows[i][1].ToString();
              SqlCmd.Parameters.Add("@family", SqlDbType.NVarChar, 80).Value = Ds.Tables[0].Rows[i][2].ToString();
              SqlCmd.Parameters.Add("@codeM", SqlDbType.Char, 15).Value = Ds.Tables[0].Rows[i][3].ToString();
              //SqlCmd.Parameters.Add("@city", SqlDbType.NVarChar, 30).Value = txb_city.Text;
              //SqlCmd.Parameters.Add("@street", SqlDbType.NVarChar, 40).Value = txb_street.Text;
              SqlCmd.Parameters.Add("@Addres", SqlDbType.NVarChar, 150).Value = Ds.Tables[0].Rows[i][4].ToString();
              SqlCmd.Parameters.Add("@telephon", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][5].ToString();
              SqlCmd.Parameters.Add("@mobile", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][6].ToString();
              SqlCmd.Parameters.Add("@rabet1", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][7].ToString();
              SqlCmd.Parameters.Add("@rabet2", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][8].ToString();
              SqlCmd.Parameters.Add("@SchoolName", SqlDbType.NVarChar, 50).Value = Ds.Tables[0].Rows[i][9].ToString();
              SqlCmd.Parameters.Add("@avg", SqlDbType.Char, 6).Value = Ds.Tables[0].Rows[i][10].ToString();
               SqlCmd.Parameters.Add("@returnValue", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
              sqlcon.Open();
  
              SqlCmd.ExecuteNonQuery();
  
              if (SqlCmd.Parameters["@returnValue"].Value.ToString() == "1")
                  counter++;
  
              sqlcon.Close();             
          }
  </code></pre>
  
  <p>in this code , read a specefice row that declare with variable "i". it work correctly .but when i use a for() , for reading all of the rows of an excell file, this code have an error 
  this is the error : </p>
  
  <blockquote>
    <p>Procedure or function SP_AddStudent has too many arguments specified.</p>
  </blockquote>
  
  <p>i think this error occured ,because speed of db is low and it can't read an write all of the rows quickly</p>
  
  <pre><code>for (int i = 0; i &lt; Ds.Tables[0].Rows.Count; i++)            
          {
              SqlCmd.Parameters.Add("@id", SqlDbType.Char, 20).Value = Ds.Tables[0].Rows[i][0].ToString();
              SqlCmd.Parameters.Add("@name", SqlDbType.NVarChar, 50).Value = Ds.Tables[0].Rows[i][1].ToString();
              SqlCmd.Parameters.Add("@family", SqlDbType.NVarChar, 80).Value = Ds.Tables[0].Rows[i][2].ToString();
              SqlCmd.Parameters.Add("@codeM", SqlDbType.Char, 15).Value = Ds.Tables[0].Rows[i][3].ToString();
              //SqlCmd.Parameters.Add("@city", SqlDbType.NVarChar, 30).Value = txb_city.Text;
              //SqlCmd.Parameters.Add("@street", SqlDbType.NVarChar, 40).Value = txb_street.Text;
              SqlCmd.Parameters.Add("@Addres", SqlDbType.NVarChar, 150).Value = Ds.Tables[0].Rows[i][4].ToString();
              SqlCmd.Parameters.Add("@telephon", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][5].ToString();
              SqlCmd.Parameters.Add("@mobile", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][6].ToString();
              SqlCmd.Parameters.Add("@rabet1", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][7].ToString();
              SqlCmd.Parameters.Add("@rabet2", SqlDbType.NChar, 15).Value = Ds.Tables[0].Rows[i][8].ToString();
              SqlCmd.Parameters.Add("@SchoolName", SqlDbType.NVarChar, 50).Value = Ds.Tables[0].Rows[i][9].ToString();
              SqlCmd.Parameters.Add("@avg", SqlDbType.Char, 6).Value = Ds.Tables[0].Rows[i][10].ToString();
               SqlCmd.Parameters.Add("@returnValue", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
              sqlcon.Open();
  
              SqlCmd.ExecuteNonQuery();
  
              if (SqlCmd.Parameters["@returnValue"].Value.ToString() == "1")
                  counter++;
  
              sqlcon.Close();
  
  
  
  
          }
  </code></pre>
  
  <p>what should i do?
   at the end
  i cant speak englishe very well, sorry...</p>