private void Button_Click(object sender, RoutedEventArgs e) { OleDbConnection con; OleDbCommand cmd; OleDbDataReader dr; String name = textbox1.Text; String password = textbox2.Password; con = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=login.accdb"); cmd = new OleDbCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "SELECT * FROM users where username='******' AND upassword='******'"; dr = cmd.ExecuteReader(); if (dr.Read()) { Wpf_doctor.DoctorWindow win2 = new Wpf_doctor.DoctorWindow(); win2.Show(); this.Close(); } else { MessageBox.Show("Kullanıcı adı ya da şifre yanlış"); } con.Close(); }
private void button_Click(object sender, RoutedEventArgs e) { OleDbConnection con; OleDbCommand cmd; OleDbDataReader dr; String name = usernametb.Text; String password = passtb.Password; con = new OleDbConnection("Provider=Microsoft.ACE.Oledb.12.0;Data Source=login.accdb"); cmd = new OleDbCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "SELECT * FROM users where username='******' AND upassword='******'"; dr = cmd.ExecuteReader(); if (dr.Read()) { String username = dr["username"].ToString(); if (username == "admin") { Wpf_doctor.DoctorWindow win2 = new Wpf_doctor.DoctorWindow(); win2.Show(); this.Close(); } else { string mainusername = username; Wpf_doctor.Patient win6 = new Wpf_doctor.Patient(mainusername); win6.Show(); this.Close(); } } else { MessageBox.Show("Kullanıcı adı ya da şifre yanlış"); } con.Close(); }
private void backbtn_Click(object sender, RoutedEventArgs e) { Wpf_doctor.DoctorWindow win5 = new Wpf_doctor.DoctorWindow(); win5.Show(); this.Close(); }