private void btnİptal_Click(object sender, EventArgs e) { frmAna frmAna = new frmAna(); this.Close(); frmAna.Show(); }
private void btnKaydet_Click(object sender, EventArgs e) { try { string queryKaydet = " update Urunler set UrunTur='" + dudUrunTur.Text + "', UrunAd='" + txtUrunAd.Text + "', UrunFiyat='" + Convert.ToInt32(txtFiyat.Text) + "', UrunAciklama='" + txtAciklama.Text + "',Adet='" + Convert.ToInt32(upAdet.Text) + "' where UrunKod='" + UrunKod + "'"; SqlConnection cnnKaydet = new SqlConnection(connectionString); SqlDataAdapter daKaydet = new SqlDataAdapter(queryKaydet, cnnKaydet); DataTable dtKaydet = new DataTable(); daKaydet.Fill(dtKaydet); MessageBox.Show("Güncelleme başarılı"); this.Close(); frmAna frmAna = new frmAna(); frmAna.Show(); } catch { MessageBox.Show("Güncelleme başarısız.Lütfen bilgileri kontrol ediniz."); } }
private void btnKaydet_Click(object sender, EventArgs e) { string queryTCKontrol = "select * from Musteriler where TCKimlikNo='" + txtTCKimlikNo.Text + "'"; SqlConnection cnnTCKontrol = new SqlConnection(connectionString); cnnTCKontrol.Open(); SqlCommand cmdTCKontrol = new SqlCommand(queryTCKontrol); cmdTCKontrol.Connection = cnnTCKontrol; SqlDataAdapter daTCKontrol = new SqlDataAdapter(queryTCKontrol, cnnTCKontrol); SqlDataReader drTCKontrol = cmdTCKontrol.ExecuteReader(); if (drTCKontrol.Read()) { MessageBox.Show("Mevcut Müşteri!"); } else { try { string telefon = txtTel1.Text + '-' + txtTel2.Text + '-' + txtTel3.Text + '-' + txtTel4.Text; string mail = txtMail1.Text + '@' + txtMail2.Text; string queryKaydet = " insert into Musteriler (TCKimlikNo,Ad,SoyAd,DogumTarih,Tel,Mail,Cinsiyet,il) values ('" + txtTCKimlikNo.Text + "','" + txtAd.Text + "','" + txtSoyad.Text + "','" + dtpDogumTarih.Value.ToString("yyyy-MM-dd") + "','" + telefon + "','" + mail + "','" + cBoxCinsiyet.Text + "','" + cBoxİl.Text + "')"; SqlConnection cnnKaydet = new SqlConnection(connectionString); SqlDataAdapter daKaydet = new SqlDataAdapter(queryKaydet, cnnKaydet); DataTable dtKaydet = new DataTable(); daKaydet.Fill(dtKaydet); MessageBox.Show("Kayıt başarılı"); this.Close(); frmAna frmAna = new frmAna(); frmAna.Show(); } catch { MessageBox.Show("Kayıt başarısız.Lütfen bilgileri kontrol ediniz."); } } }
private void btnKaydet_Click(object sender, EventArgs e) { string queryUrunAdiKontrol = "select * from Urunler where UrunAd='" + txtUrunAd.Text + "'"; SqlConnection cnnUrunAdiKontrol = new SqlConnection(connectionString); cnnUrunAdiKontrol.Open(); SqlCommand cmdUrunAdiKontrol = new SqlCommand(queryUrunAdiKontrol); cmdUrunAdiKontrol.Connection = cnnUrunAdiKontrol; SqlDataAdapter daUrunAdiKontrol = new SqlDataAdapter(queryUrunAdiKontrol, cnnUrunAdiKontrol); SqlDataReader drUrunAdiKontrol = cmdUrunAdiKontrol.ExecuteReader(); if (drUrunAdiKontrol.Read()) { MessageBox.Show("Mevcut Ürün!"); } else { try { string queryKaydet = " insert into Urunler values ('" + dudUrunTur.Text + "','" + txtUrunAd.Text + "','" + Convert.ToInt32(txtUrunFiyat.Text) + "','" + txtAciklama.Text + "','" + Convert.ToInt32(TAdet.Text) + "')"; SqlConnection cnnKaydet = new SqlConnection(connectionString); SqlDataAdapter daKaydet = new SqlDataAdapter(queryKaydet, cnnKaydet); DataTable dtKaydet = new DataTable(); daKaydet.Fill(dtKaydet); // MessageBox.Show("Kayıt başarılı"); this.Close(); frmAna frmAna = new frmAna(); frmAna.Show(); } catch { MessageBox.Show("Kayıt başarısız.Lütfen bilgileri kontrol ediniz."); } } }
private void btnSiparis_Click(object sender, EventArgs e) { try { string querySiparisVer = "insert into Siparisler (UrunKod,SiparisAdet,SiparisTeslimTarih) values('" + Convert.ToInt32(txtUrunKod.Text) + "','" + Convert.ToInt32(txtAdet.Text) + "','" + dtpSiparisTeslim.Value.ToString("yyyy-MM-dd") + "')"; SqlConnection cnnSiparisVer = new SqlConnection(connectionString); SqlDataAdapter daSiparisVer = new SqlDataAdapter(querySiparisVer, cnnSiparisVer); DataTable dtSiparisVer = new DataTable(); daSiparisVer.Fill(dtSiparisVer); MessageBox.Show("Sipariş Verildi."); this.Close(); frmAna frmAna = new frmAna(); frmAna.Show(); } catch { MessageBox.Show("Hata"); } }
private void btnKaydet_Click(object sender, EventArgs e) { string queryKullaniciAdiKontrol = "select * from Kullanicilar where KullaniciAd='" + txtKullaniciAdi.Text + "'"; SqlConnection cnnKullaniciAdiKontrol = new SqlConnection(connectionString); cnnKullaniciAdiKontrol.Open(); SqlCommand cmdKullaniciAdiKontrol = new SqlCommand(queryKullaniciAdiKontrol); cmdKullaniciAdiKontrol.Connection = cnnKullaniciAdiKontrol; SqlDataAdapter daKullaniciAdiKontrol = new SqlDataAdapter(queryKullaniciAdiKontrol, cnnKullaniciAdiKontrol); SqlDataReader drKullaniciAdiKontrol = cmdKullaniciAdiKontrol.ExecuteReader(); if (drKullaniciAdiKontrol.Read()) { MessageBox.Show("Mevcut kullanıcı!"); } else { try { string queryKaydet = " insert into Kullanicilar values ('" + txtKullaniciAdi.Text + "','" + txtSifre.Text + "','" + txtAd.Text + "','" + txtSoyad.Text + "' ,'" + dudYetki.Text + "')"; SqlConnection cnnKaydet = new SqlConnection(connectionString); SqlDataAdapter daKaydet = new SqlDataAdapter(queryKaydet, cnnKaydet); DataTable dtKaydet = new DataTable(); daKaydet.Fill(dtKaydet); MessageBox.Show("Kayıt başarılı"); this.Close(); frmAna frmAna = new frmAna(); frmAna.Show(); } catch { MessageBox.Show("Kayıt başarısız.Lütfen bilgileri kontrol ediniz."); } } }