title: SqlDataReader check checkbox if item is in table
body: <p>Im wondering how to make my checkboxes in column[3]in dtg_ksluzby checked when the value is in the DB.</p>
  
  <p>klisluz(table where I get the data from) contains columns, id, subkey(which is = vyberradek), text, pocet
  This is code for inserting into db.</p>
  
  <pre><code>  foreach (DataGridViewRow row in dtg_ksluzby.Rows)
              {
  
                  if (Convert.ToBoolean(row.Cells[3].Value) == true) 
                  {
                      SqlCommand prikaz2 = new SqlCommand("INSERT INTO klisluz(text,pocet,akce,subkey) values(@val1,@val2,@val3,@val4) ", spojeni);
                      prikaz2.Parameters.AddWithValue("@val1", row.Cells["text"].Value);
                      prikaz2.Parameters.AddWithValue("@val2", row.Cells["pocet"].Value);
                      prikaz2.Parameters.AddWithValue("@val3", row.Cells["akce"].Value);
                      prikaz2.Parameters.AddWithValue("@val4", max + 1);
                      spojeni.Open();
                      prikaz2.ExecuteNonQuery();
                      spojeni.Close();
                  }
              }
  </code></pre>
  
  <p>Now I would like to check the checkbox when the item is inserted in DB.
  Would someone propose me a clue please?</p>
  
  <p>I think I can algorithm this isssue, but I have no idea how can I turn it into the code I thought I can do it somehoe like this :</p>
  
  <pre><code> SqlCommand novyprikaz3 = new SqlCommand("SELECT * FROM klient WHERE ID_K=" + vyberradek, spojeni); //vyberradek selects row ID
              spojeni.Open();
              SqlDataReader precti = novyprikaz.ExecuteReader();
  
              if (precti.Read())
              {
                  If text in (row where ID_K=number which comes from vyberradek) is in dtg_ksluzby then check the checkbox in the same row 
   }
  </code></pre>
  
  <p>I would like to use this for USER to know which columns did he selected before when he is editing
  Thank so much in advance.</p>