private void btnGiris_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("Select * From Tbl_Hastalar Where HastaTC=@p1 and HastaSifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", msktxtTC.Text); komut.Parameters.AddWithValue("@p2", txtSifre.Text); SqlDataReader dr = komut.ExecuteReader(); if (dr.Read() && lblPin.Text == txtrndmpin.Text) { FrmHastaDetay frm = new FrmHastaDetay(); frm.tc = msktxtTC.Text; frm.Show(); this.Hide(); } else { MessageBox.Show("Hatalı TC kimlik numarası ya da şifre...\nLütfen kontrol ediniz.", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnGirisYap_Click(object sender, EventArgs e) { SqlCommand komut = new SqlCommand("Select * From Tbl_Hasta Where HastaTc=@p1 and HastaSifre=@p2", bgl.baglanti()); komut.Parameters.AddWithValue("@p1", MskTC.Text); komut.Parameters.AddWithValue("@p2", TxtSifre.Text); SqlDataReader dr = komut.ExecuteReader(); if (dr.Read()) { FrmHastaDetay fr = new FrmHastaDetay(); fr.tc = MskTC.Text; fr.Show(); this.Hide(); } else { MessageBox.Show("Invalid TC or Password"); } bgl.baglanti().Close(); }