private void btnYoklama_Click(object sender, EventArgs e) { OGRENCI_DEVAMSIZLIK ogr = new OGRENCI_DEVAMSIZLIK(); foreach (DataGridViewRow item in dgYoklama.Rows) { ogr.OGRENCI_ID = Convert.ToInt32(item.Cells[0].Value.ToString().Substring(3, 1)); ogr.DERS_ID = 1; ogr.TARIH = DateTime.Now.Date; Veritabani.OGRENCI_DEVAMSIZLIK_EKLE(ogr); } }