Israel

Israel

  • 701
  • 1.3k
  • 217.3k

Doesnt obey to update?

Sep 15 2015 7:25 AM
Hi!
 
I have a little bit confusion. I need to update at the same time at diferente database. The condition is when the code is egal on what that "combobox" then update. Curiosly its doenst obey... Means that even I choose any another code its still update. That is wrong!
Its should update ONLY when the code is the same as I choose (or write) into the combobox:
 
private void button4_Click(object sender, EventArgs e)
conn.Open();
OleDbParameter jan = new OleDbParameter("@january", SqlDbType.VarChar);
OleDbParameter cod = new OleDbParameter("@cod", SqlDbType.VarChar);
comm.Parameters.Add(jan);
comm.Parameters.Add(cod);
jan.Value = "PAYED";
cod.Value = cbxCod.Text;
comm.Connection = conn;
comm.CommandText = "UPDATE bill SET january = ? WHERE codcliente = @cod";
comm.ExecuteNonQuery();
//{
// conn.Close();
//}
/////////////////////////////////////////
OleDbParameter janregist = new OleDbParameter("@jan", SqlDbType.VarChar);
OleDbParameter codclienteregist = new OleDbParameter("@codcliente", SqlDbType.VarChar);
comm.Parameters.Add(janregist);
comm.Parameters.Add(codclienteregist);
janregist.Value = "PAYED";
codclienteregist.Value = cbxCod.Text;
comm.Connection = conn;
comm.CommandText = "UPDATE registration SET jan = ? WHERE codcliente = @codcliente";
comm.ExecuteNonQuery();
{
conn.Close();
}
 
 
 

Answers (2)