private void geri_Click(object sender, EventArgs e) { this.Hide(); Form3 frm = new Form3(); frm.Show(); }
private void button1_Click(object sender, EventArgs e) { // OleDbCommand cmd = new OleDbCommand("INSERT INTO anamnez_formu(HASTA_ID,SORU,CEVAP) VALUES (" + p + "," + i + ",'" + cevap[0] + "')", baglanti); OleDbCommand komut; OleDbDataReader oku; DialogResult Sor = MessageBox.Show("Yeni Kayıt Eklensin Mi ?", "Kayıt Ekle", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (Sor == DialogResult.Yes) { Baglanti(); for (int i = 0; i < cevap.Length;i++ ){ try { komut = new OleDbCommand(); komut.CommandText = "INSERT INTO anamnez_formu(HASTA_ID,SORU,CEVAP)VALUES(" + p + "," + i + ",'" + cevap[i] + "');"; komut.Connection = baglanti; oku = komut.ExecuteReader(); } catch (OleDbException ex) { MessageBox.Show(ex.Message); } } this.Hide(); Form3 frm = new Form3(); frm.Show(); } }
void baglantim() { string kadi = textBox1.Text; string sifre = textBox2.Text; if ((textBox1.Text == "") && (textBox2.Text == "")) { MessageBox.Show("Kullanıcı Adı ve Şifre Girmediniz"); } try { if (kadi != null & sifre != null) { string kaynak = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=disciotomasyonu.mdb"; OleDbConnection baglanti = new OleDbConnection(kaynak); OleDbCommand sorgu = new OleDbCommand("SELECT * FROM personel", baglanti); OleDbDataReader okuyucu; bool onay1 = false; bool onay2 = false; try { baglanti.Open(); okuyucu = sorgu.ExecuteReader(); while (okuyucu.Read()) { if ((kadi == "dr" + okuyucu["KULLANICI_ADI"].ToString()) && (sifre == okuyucu["SIFRE"].ToString()) || (kadi =="st"+okuyucu["KULLANICI_ADI"].ToString()) && (sifre == okuyucu["SIFRE"].ToString())) { onay1 = true; onay2 = true; break; } } baglanti.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (onay1 == true) { baglanti.Open(); okuyucu = sorgu.ExecuteReader(); while (okuyucu.Read()) { if ((kadi == "st" + okuyucu["KULLANICI_ADI"].ToString()) && (sifre == okuyucu["SIFRE"].ToString())) { Form3 frm3 = new Form3(); frm3.Show(); this.Hide(); } } baglanti.Close(); } if (onay2 == true) { baglanti.Open(); okuyucu = sorgu.ExecuteReader(); while (okuyucu.Read()) { if ((kadi == "dr" + okuyucu["KULLANICI_ADI"].ToString()) && (sifre == okuyucu["SIFRE"].ToString())) { Form10 frm10 = new Form10(); frm10.Show(); this.Hide(); } } baglanti.Close(); } else { baglanti.Close(); MessageBox.Show("Kullanıcı adı veya şifreyi yanlış girdiginiz !", ":: Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } catch (Exception exp) { MessageBox.Show(exp.ToString()); } }
private void button2_Click(object sender, EventArgs e) { DialogResult result; result = MessageBox.Show("İptal Etmek İstiyor musunuz?", "Çıkış", MessageBoxButtons.YesNo); if (result == DialogResult.No) { //MessageBox.Show("App won´t close"); } if (result == DialogResult.Yes) { //this.Dispose(); this.Hide(); Form3 frm = new Form3(); frm.Show(); } }