private void btnEtkinlikKaydet_Click(object sender, EventArgs e) { //etkinlik ekleme kodları buraya yazılacak if (txtAdi.Text == "" || txtKonu.Text == "" || txtYer.Text == "") { System.Windows.Forms.MessageBox.Show("LÜTFEN YILDIZLI ALANLARI DOLDURUNUZ !"); } else { connection.Open(); SqlCommand cekle = new SqlCommand("insert into Etkinlik (etkinlik_ad,etkinlik_konu,etkinlik_konusmaci,etkinlik_yer,etkinlik_tarih) values (@prmtr2,@prmtr3,@prmtr4,@prmtr5,@prmtr6)", connection); cekle.Parameters.AddWithValue("@prmtr2", txtAdi.Text); cekle.Parameters.AddWithValue("@prmtr3", txtKonu.Text); cekle.Parameters.AddWithValue("@prmtr4", txtKonusmacilar.Text); cekle.Parameters.AddWithValue("@prmtr5", txtYer.Text); cekle.Parameters.AddWithValue("@prmtr6", dateTimePicker1.Text); cekle.ExecuteNonQuery(); connection.Close(); System.Windows.Forms.MessageBox.Show("KAYIT İŞLEMİ BAŞARILI"); this.Close(); anasayfa a = System.Windows.Forms.Application.OpenForms["anasayfa"] as anasayfa; a.etkinlikListele(); } }
private void btnEtkinlikGuncelle_Click(object sender, EventArgs e) { connection.Open(); SqlCommand guncelle = new SqlCommand("update Etkinlik set etkinlik_ad='" + txtAdi.Text + "' , etkinlik_konu='" + txtKonu.Text + "' , etkinlik_konusmaci='" + txtKonusmacilar.Text + "' , etkinlik_yer='" + txtYer.Text + "' , etkinlik_tarih='" + dateTimePicker1.Text + "' where etkinlik_id='" + _ID + "'", connection); guncelle.ExecuteNonQuery(); connection.Close(); System.Windows.Forms.MessageBox.Show("Kayıt Değiştirildi"); this.Close(); anasayfa a = System.Windows.Forms.Application.OpenForms["anasayfa"] as anasayfa; a.etkinlikListele(); }