title: how can i clear this error in c# programing
body: <p>In this code every time <code>ShenasehSamapel</code> is two equal values I get an exception that says field <code>ShenasehSamapel</code> is not the primary key: </p>
  
  <blockquote>
    <p>"The variable name '@ShenasehSamapel' has already been declared.
    Variable names must be unique within a query batch or stored
    procedure."</p>
  </blockquote>
  
  <p>Here is the code that generates the error:</p>
  
  <pre><code>    private void btnDefineNewKala_Click(object sender, EventArgs e)
      { 
          if (txtShenasehSamapel.Text != "" &amp; txtKalaName.Text != "")
          {
              //Anbar.FildArray[0]= txtRadif.Text;
              Anbar.FildArray [1]= txtShenasehSamapel.Text;
              Anbar.FildArray[2] =txtKalaName.Text;
              string strDefineKala = "insert into AnbarFava.dbo.DefineKala (ShenasehSamapel ,KalaName )" +
                                    " values ( @ShenasehSamapel , @KalaName )";
              //Anbar.AnbarCMD.Parameters.AddWithValue("@Radif", Anbar.FildArray[0]);
              Anbar.AnbarCMD.Parameters.AddWithValue("@ShenasehSamapel", Anbar.FildArray[1]);
              Anbar.AnbarCMD.Parameters.AddWithValue("@KalaName", Anbar.FildArray[2]);
  
              Anbar.RunQuery(strDefineKala);
              for (int Element = 0; Element &lt;= Anbar.FildArray.Length - 1; Element++)
              {   Anbar.FildArray[Element] = null;    }
              //txtRadif.Text  = " ";
              txtShenasehSamapel.Text = "";
              txtKalaName.Text = "";
              /**/
              string strcmd = "select * from AnbarFava.dbo.DefineKala";
              SqlDataAdapter thisDataAdapter = new SqlDataAdapter(strcmd, Anbar.strCNN);
              DataTable thisDataTable = new DataTable();
              thisDataAdapter.Fill(thisDataTable);
              dgvDefineKala.DataSource = thisDataTable;
          }
          else
          { 
              MessageBox.Show("لطفا تمام خانه ها را پر کنید", "خطا",
                               MessageBoxButtons.OK); } 
      }
  </code></pre>