private void btnKaydet_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox4.Text == "" || comboBox1.Text == "" || label8.Text == "") { System.Windows.Forms.MessageBox.Show("LÜTFEN YILDIZLI ALANLARI DOLDURUNUZ"); } else { connection.Open(); SqlCommand cekle = new SqlCommand("insert into Uyeler (uye_ad,uye_soyad,uye_sinif,uye_no,uye_adres,uye_telefon,uye_kayitucreti,uye_gorev,uye_kayityil,uye_resim) values (@prmtr2,@prmtr3,@prmtr4,@prmtr5,@prmtr6,@prmtr7,@prmtr8,@prmtr9,@prmtr10,@prmtr11)", connection); cekle.Parameters.AddWithValue("@prmtr2", textBox1.Text); cekle.Parameters.AddWithValue("@prmtr3", textBox2.Text); cekle.Parameters.AddWithValue("@prmtr4", comboBox1.Text); cekle.Parameters.AddWithValue("@prmtr5", textBox4.Text); cekle.Parameters.AddWithValue("@prmtr6", textBox5.Text); cekle.Parameters.AddWithValue("@prmtr7", maskedTextBox1.Text); cekle.Parameters.AddWithValue("@prmtr8", textBox6.Text); cekle.Parameters.AddWithValue("@prmtr9", textBox7.Text); cekle.Parameters.AddWithValue("@prmtr10", dateTimePicker1.Text); cekle.Parameters.AddWithValue("@prmtr11", label8.Text); cekle.ExecuteNonQuery(); connection.Close(); MessageBox.Show("KAYIT BAŞARILI"); this.Close(); anasayfa a = Application.OpenForms["anasayfa"] as anasayfa; a.uyelerListele(); } }
private void btnGuncelle_Click_1(object sender, EventArgs e) { connection.Open(); SqlCommand guncelle = new SqlCommand("update Uyeler set uye_ad='" + textBox1.Text + "',uye_soyad='" + textBox2.Text + "',uye_sinif='" + comboBox1.Text + "',uye_no='" + textBox4.Text + "',uye_adres='" + textBox5.Text + "',uye_telefon='" + maskedTextBox1.Text + "',uye_kayitucreti='" + textBox6.Text + "',uye_gorev='" + textBox7.Text + "',uye_resim='" + label8.Text + "' where uye_id='" + _ID + "'", connection); guncelle.ExecuteNonQuery(); connection.Close(); MessageBox.Show("Kayıt Değiştirildi"); this.Close(); anasayfa a = Application.OpenForms["anasayfa"] as anasayfa; a.uyelerListele(); a.kadroListele(); }