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") { Team7Senior.DoctorWindow win2 = new Team7Senior.DoctorWindow(); win2.Show(); this.Close(); } else { string mainusername = username; Team7Senior.Patient win6 = new Team7Senior.Patient(mainusername); win6.Show(); this.Close(); } } else { MessageBox.Show("Kullanıcı adı ya da şifre yanlış"); } con.Close(); }
private void dispose_window() { Team7Senior.Patient patient = new Team7Senior.Patient(userInfo.Username); patient.Show(); this.Close(); }