Hello,
U can try it:
for (int i = 0; i < dgv1.Rows.Count; i++)
{
if((bool)this.dgv1.Rows[i].Cells["checkBoxColumn"].Value == true)
{
SqlCommand prikaz2 = new SqlCommand("INSERT INTO klisluz(text,pocet,akce,subkey) values(@val1,@val2,@val3,@val4) ", spojeni);
prikaz2.Parameters.AddWithValue("@val1", dtg_ksluzby.Rows[i].Cells["text"].Value);
prikaz2.Parameters.AddWithValue("@val2", dtg_ksluzby.Rows[i].Cells["pocet"].Value);
prikaz2.Parameters.AddWithValue("@val3", dtg_ksluzby.Rows[i].Cells["akce"].Value);
prikaz2.Parameters.AddWithValue("@val4", max + 1); spojeni.Open();
prikaz2.ExecuteNonQuery();
spojeni.Close();
}
}
Best regards!