private void btnDemirbasKaydet_Click_1(object sender, EventArgs e) { if (textBox2.Text == "" || numericUpDown1.Text == "0") { System.Windows.Forms.MessageBox.Show("LÜTFEN YILDIZLI ALANLARI DOLDURUNUZ !"); } else { connection.Open(); SqlCommand cekle = new SqlCommand("insert into Demirbaslar (demirbas_ad,demirbas_adet,demirbas_cins,demirbas_yil) values (@prmtr2,@prmtr3,@prmtr4,@prmtr5)", connection); cekle.Parameters.AddWithValue("@prmtr2", textBox2.Text); cekle.Parameters.AddWithValue("@prmtr3", numericUpDown1.Text); cekle.Parameters.AddWithValue("@prmtr4", textBox4.Text); cekle.Parameters.AddWithValue("@prmtr5", dateTimePicker1.Text); cekle.ExecuteNonQuery(); connection.Close(); System.Windows.Forms.MessageBox.Show("Kayıt Başarılı", "Bilgi"); this.Close(); anasayfa a = System.Windows.Forms.Application.OpenForms["anasayfa"] as anasayfa; a.demirbasListele(); } }
private void btnDemirbasGuncelle_Click_1(object sender, EventArgs e) { connection.Open(); SqlCommand guncelle = new SqlCommand("update Demirbaslar set demirbas_ad='" + textBox2.Text + "' , demirbas_adet='" + numericUpDown1.Text + "', demirbas_cins='" + textBox4.Text + "' where demirbas_id='" + _ID + "'", connection); guncelle.ExecuteNonQuery(); connection.Close(); System.Windows.Forms.MessageBox.Show("Kayıt Güncellendi", "Bilgi"); this.Close(); anasayfa a = System.Windows.Forms.Application.OpenForms["anasayfa"] as anasayfa; a.demirbasListele(); }