private void button3_Click(object sender, EventArgs e) { int a; int b = int.Parse(numericUpDown1.Value.ToString()); if (rd1.Checked == true) { a = 1; } else { a = 0; } cmd.CommandText = "select Distinct O.OgrenciId from dersler D, ogrenci O,alınan_dersler AD, ilgi I where AD.DersId = " + min2 + " and AD.OgrenciId = O.OgrenciId and O.Ogrenciisim = '" + ogrenciisim2 + "'"; string ıd = cmd.ExecuteScalar().ToString(); cmd.CommandText = "Select Distinct Y.yoklama from ogrenci O,yoklama Y where Y.OgrenciId=O.OgrenciId and Y.DersId=" + min2 + " and O.Ogrenciisim='" + ogrenciisim2 + "'and Y.tarih='" + date2 + "'"; object val3 = cmd.ExecuteScalar(); if (val3 == null) { cmd.CommandText = "INSERT INTO yoklama (`Tarih`, `DersId`, `OgrenciId`, `Yoklama`) VALUES('" + date2 + "', '" + min2 + "', '" + ıd + "', '" + a + "')"; cmd.ExecuteNonQuery(); } else { cmd.CommandText = "UPDATE yoklama SET `yoklama` = '" + a + "'WHERE DersId='" + min2 + "' and OgrenciId='" + ıd + "'and Tarih='" + date2 + "'"; cmd.ExecuteNonQuery(); } cmd.CommandText = "Select Distinct I.Durum from ogrenci O,ilgi I where I.OgrenciId=O.OgrenciId and I.DersId=" + min2 + " and O.Ogrenciisim='" + ogrenciisim2 + "'and I.tarih='" + date2 + "'"; object val = cmd.ExecuteScalar(); if (val == null) { cmd.CommandText = "INSERT INTO ilgi (`Tarih`, `DersId`, `OgrenciId`, `Durum`) VALUES ('" + date2 + "', '" + min2 + "', '" + ıd + "', '" + b + "')"; cmd.ExecuteNonQuery(); } else { cmd.CommandText = "UPDATE ilgi SET `durum` = '" + b + "'WHERE DersId='" + min2 + "' and OgrenciId='" + ıd + "'and Tarih='" + date2 + "'"; cmd.ExecuteNonQuery(); } MessageBox.Show("Güncellenmiştir."); this.Dispose(); ÖğrenciBireyselSayfa say = new ÖğrenciBireyselSayfa(egitmenisim2, ogrenciisim2, min2, date2); say.ShowDialog(); }
private void button5_Click(object sender, EventArgs e) { cmd.CommandText = "select Distinct O.OgrenciId from dersler D, ogrenci O,alınan_dersler AD, ilgi I where I.DersId = AD.DersId and AD.DersId = " + min2 + " and AD.OgrenciId = O.OgrenciId and O.Ogrenciisim = '" + ogrenciisim2 + "' and I.tarih = '" + date2 + "'"; string ıd = cmd.ExecuteScalar().ToString(); if (textBox1.Text != null) { string b = textBox1.Text; cmd.CommandText = "UPDATE ogrenci SET `OgrenciGörüş` = '" + b + "'WHERE OgrenciId='" + ıd + "'"; cmd.ExecuteNonQuery(); MessageBox.Show("Güncellenmiştir."); this.Dispose(); ÖğrenciBireyselSayfa say = new ÖğrenciBireyselSayfa(egitmenisim2, ogrenciisim2, min2, date2); say.ShowDialog(); } }
private void ListBox6_MouseDoubleClick(object sender, MouseEventArgs e) { string curItem = listBox6.SelectedItem.ToString(); int id = 0; try { cmd.CommandText = "select Distinct OgrenciId from ogrenci where OgrenciIsim='" + curItem + "'"; id = int.Parse(cmd.ExecuteScalar().ToString()); this.Dispose(); ÖğrenciBireyselSayfa og = new ÖğrenciBireyselSayfa(isim2, curItem, min2, date2); og.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }