private void check_User_login() { string hashed_password = create_hash(txtPassword.Text); clsDBConnector dbConnector = new clsDBConnector(); OleDbDataReader dr; string sqlStr; dbConnector.Connect(); sqlStr = "SELECT tblUsers.User_ID FROM ((tblSchools INNER JOIN tblTeachers ON tblSchools.School_ID = tblTeachers.School_ID) INNER JOIN tblUsers ON tblSchools.School_ID = tblUsers.School_ID AND tblTeachers.Teacher_ID = tblUsers.Teacher_ID) WHERE (tblUsers.UserName = '******') AND (tblUsers.pwdHash = '" + hashed_password + "') AND (tblSchools.School_Name = '" + txtSchool.Text.ToLower() + "')"; dr = dbConnector.DoSQL(sqlStr); if (dr.HasRows) // Checks if a student exists with that username, school and password { frmOperators frmOperator = new frmOperators(txtUsername.Text); //Shows the Operator form as the logged user frmOperator.ShowDialog(); this.Close(); } else { MessageBox.Show("Login Failed");//tells user their login failed } }
private void btnOperators_Click(object sender, EventArgs e) { frmOperators frmOperators = new frmOperators("teacher"); frmOperators.ShowDialog(); }