private void btnProjeKaydet_Click(object sender, EventArgs e) { if (textBox3.Text == "" || textBox2.Text == "" || textBox4.Text == "" || textBox7.Text == "" || comboBox1.Text == "" || textBox6.Text == "" || textBox5.Text == "") { System.Windows.Forms.MessageBox.Show("LÜTFEN YILDIZLI ALANLARI DOLDURUNUZ"); } else { connection.Open(); SqlCommand cekle = new SqlCommand("insert into Projeler (proje_ad,proje_konu,proje_aciklama,proje_yil,yapan_ad,yapan_soyad,yapan_sinif,yapan_no) values (@prmtr2,@prmtr3,@prmtr4,@prmtr5,@prmtr6,@prmtr7,@prmtr8,@prmtr9)", connection); cekle.Parameters.AddWithValue("@prmtr2", textBox2.Text); cekle.Parameters.AddWithValue("@prmtr3", textBox3.Text); cekle.Parameters.AddWithValue("@prmtr4", textBox4.Text); cekle.Parameters.AddWithValue("@prmtr5", dateTimePicker1.Text); cekle.Parameters.AddWithValue("@prmtr6", textBox7.Text); cekle.Parameters.AddWithValue("@prmtr7", textBox6.Text); cekle.Parameters.AddWithValue("@prmtr8", comboBox1.Text); cekle.Parameters.AddWithValue("@prmtr9", textBox5.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.projeListele(); } }
private void btnProjeGuncelle_Click(object sender, EventArgs e) { connection.Open(); SqlCommand guncelle = new SqlCommand("update Projeler set proje_ad='" + textBox2.Text + "', proje_konu='" + textBox3.Text + "' , proje_aciklama='" + textBox4.Text + "', proje_yil='" + dateTimePicker1.Text + "' , yapan_ad='" + textBox7.Text + "' , yapan_soyad='" + textBox6.Text + "' , yapan_sinif='" + comboBox1.Text + "' , yapan_no='" + textBox5.Text + "' where proje_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.projeListele(); }