private void BtnKaydet_Click(object sender, EventArgs e) { SqlCommand komutkaydet = new SqlCommand("insert into Ogrenci(OgrAd,OgrSoyad,OgrTc,OgrTelefon,OgrDogum,OgrMail,OgrOdano,OgrVeliAdSoyad,OgrVeliTelefon,OgrVeliAdres,OgrBolum) Values(@p1,@p2,@p3,@p4,@p5,@p6,@p7,@p8,@p9,@p10,@p11)", bgl.baglanti()); komutkaydet.Parameters.AddWithValue("@p1", TxtOgrenciad.Text); komutkaydet.Parameters.AddWithValue("@p2", TxtOgrSoyad.Text); komutkaydet.Parameters.AddWithValue("@p3", MskTC.Text); komutkaydet.Parameters.AddWithValue("@p4", MskTelefon.Text); komutkaydet.Parameters.AddWithValue("@p5", MskDogum.Text); komutkaydet.Parameters.AddWithValue("@p6", TxtMail.Text); komutkaydet.Parameters.AddWithValue("@p7", CmbOdano.Text); komutkaydet.Parameters.AddWithValue("@p8", TxtVeliAdSoy.Text); komutkaydet.Parameters.AddWithValue("@p9", MskVeliTel.Text); komutkaydet.Parameters.AddWithValue("@p10", RichAdres.Text); komutkaydet.Parameters.AddWithValue("@p11", CmbBolum.Text); komutkaydet.ExecuteNonQuery(); bgl.baglanti().Close(); FrmOgrenciListe ogrlis = new FrmOgrenciListe(); ogrlis.Show(); this.Hide(); SqlCommand komut3 = new SqlCommand("select ogrid from Ogrenci", bgl.baglanti()); SqlDataReader oku = komut3.ExecuteReader(); while (oku.Read()) { label12.Text = oku[0].ToString(); } bgl.baglanti().Close(); SqlCommand komut2 = new SqlCommand("insert into Borclar (Ogrid,OgrAd,OgrSoyad) values (@b1,@b2,@b3)", bgl.baglanti()); komut2.Parameters.AddWithValue("@b1", label12.Text); komut2.Parameters.AddWithValue("@b2", TxtOgrenciad.Text); komut2.Parameters.AddWithValue("@b3", TxtOgrSoyad.Text); komut2.ExecuteNonQuery(); bgl.baglanti().Close(); SqlCommand komutoda = new SqlCommand("update odalar set odaAktif=odaAktif+1 Where OdaNo=@oda1", bgl.baglanti()); komutoda.Parameters.AddWithValue("@oda1", CmbOdano.Text); komutoda.ExecuteNonQuery(); bgl.baglanti().Close(); // Listetemizle(); }
private void button1_Click(object sender, EventArgs e) { SqlCommand komutsil = new SqlCommand("delete from Ogrenci where ogrid=@id", bgl.baglanti()); komutsil.Parameters.AddWithValue("@id", TxtOgrid.Text); komutsil.ExecuteNonQuery(); bgl.baglanti().Close(); SqlCommand komutoda = new SqlCommand("update odalar set odaaktif=odaaktif-1 where odano=@az1", bgl.baglanti()); komutoda.Parameters.AddWithValue("@az1", CmbOdano.Text); komutoda.ExecuteNonQuery(); bgl.baglanti().Close(); FrmOgrenciListe frm = new FrmOgrenciListe(); frm.Show(); this.Hide(); }
private void BtnDuzenle_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("update Ogrenci set Ograd=@p2, OgrSoyad=@p3,OgrTC=@p4,Ogrtelefon=@p5,ogrdogum=@p6,ogrmail=@p7,ogrodano=@p8,ogrveliadsoyad=@p9,ogrvelitelefon=@p10,ogrveliadres=@p11,ogrbolum=@p12 where ogrid=@p1", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", TxtOgrid.Text); komut.Parameters.AddWithValue("@p2", TxtOgrenciad.Text); komut.Parameters.AddWithValue("@p3", TxtOgrSoyad.Text); komut.Parameters.AddWithValue("@p4", MskTC.Text); komut.Parameters.AddWithValue("@p5", MskTelefon.Text); komut.Parameters.AddWithValue("@p6", MskDogum.Text); komut.Parameters.AddWithValue("@p7", TxtMail.Text); komut.Parameters.AddWithValue("@p8", CmbOdano.Text); komut.Parameters.AddWithValue("@p9", TxtVeliAdSoy.Text); komut.Parameters.AddWithValue("@p10", MskVeliTel.Text); komut.Parameters.AddWithValue("@p11", RichAdres.Text); komut.Parameters.AddWithValue("@p12", CmbBolum.Text); komut.ExecuteNonQuery(); bgl.baglanti().Close(); FrmOgrenciListe frm = new FrmOgrenciListe(); frm.Show(); this.Hide(); }
private void öğrenciDüzenleToolStripMenuItem_Click(object sender, EventArgs e) { FrmOgrenciListe frm = new FrmOgrenciListe(); frm.Show(); }