private void Button_Login_Click(object sender, EventArgs e) { // These are the Text box and combobox stuffs... string username = TextBox_UserName.Text; string password = TextBox_Password.Text; string usertype = ComboBox_SelectUser.Text; // from here databse connection starts.. DB db = new DB(); DataTable table = new DataTable(); MySqlDataAdapter adapter = new MySqlDataAdapter(); MySqlCommand command = new MySqlCommand("SELECT * FROM users WHERE username = @usn and password = @pass and usertype = @type", db.getConnection()); command.Parameters.Add("@usn", MySqlDbType.VarChar).Value = username; command.Parameters.Add("@pass", MySqlDbType.VarChar).Value = password; command.Parameters.Add("@type", MySqlDbType.VarChar).Value = usertype; adapter.SelectCommand = command; adapter.Fill(table); // here ends database things. if (usertype == "Manager") { if (table.Rows.Count > 0) { // MessageBox.Show("Manager Login Successful"); this.Hide(); ManagerForm managerform = new ManagerForm(); managerform.Show(); // from here we are going to manager page.. } else { MessageBox.Show("Manager Login Unsuccessful"); TextBox_UserName.Clear(); TextBox_Password.Clear(); } } else if (usertype == "Admin") { if (table.Rows.Count > 0) { //MessageBox.Show("Admin Login Successful"); this.Hide(); AdminForm adminform = new AdminForm(); adminform.Show(); // from here we are going to admin page.. } else { MessageBox.Show("Admin Login Unsuccessful"); TextBox_UserName.Clear(); TextBox_Password.Clear(); } } }