Nel

Nel

  • NA
  • 716
  • 1m

Problem with update of the record

Oct 20 2011 3:02 AM
Hi,
Could anybody help me please and tell me what's wrong with my code? Here it is:
OleDbCommand command = new OleDbCommand();
 
  command.Connection = conn; 
  command.CommandText = "Update Kazneti set Imeprezime=?, Adresa=?, Datumstar=? where Rbr=?";
  command.Parameters.AddWithValue("@imeprez", txtImePrez.Text);
  command.Parameters.AddWithValue("@adresa", txtAdresa.Text);
  command.Parameters.AddWithValue("@datn", txtDatumnov.Text);
  command.Parameters.AddWithValue("@rbr", comboBox1.SelectedValue);
  try
  {
  conn.Open();
  OleDbDataAdapter oleDBDataAdapter1 = new OleDbDataAdapter(new OleDbCommand("Select * from Kazneti order by Imeprezime asc", conn));
  _dataset.Clear();
  oleDBDataAdapter1.Fill(_dataset, "Kazneti");
  command.ExecuteNonQuery();//I got en error "Data type mismatch in criteria expression." here
  }


Thank you.

Answers (4)