mercredi 23 novembre 2016

Checking the checkbox based on its ID from the database

i am having problem with this, can anyone help me?

 con.Open();
 sqc = con.CreateCommand();
  string query3 = "Select DeductionID from tbl_emp_deduct where EmployeeID like @pa";
  sqc.Parameters.AddWithValue("@pa", "%" + lblEmpID.Text + "%");
  sqc.CommandText = query3;
  sda = new SqlDataAdapter(sqc);
  ds = new DataSet();
  sda.Fill(ds);
          for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                  lvDeductions.Items[i].Checked = true;
                  }

if i run the code in SSMS the deduction id output is 263,

but in my listview the checked item is deduction id 262, why is that? run on my program




Aucun commentaire:

Enregistrer un commentaire