public EmployeePersonalInformation(HRMainForm HRMainForm) { try { InitializeComponent(); dbconnection = new MySqlConnection(connection.connectionString); this.HRMainForm = HRMainForm; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void txtPassword_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { string query = "select User_ID, User_Name from users where User_Name=@Name and Password=@Pass and (User_Type=0 or User_Type=2)"; conn.Open(); MySqlCommand comand = new MySqlCommand(query, conn); comand.Parameters.AddWithValue("@Name", txtName.Text); comand.Parameters.AddWithValue("@Pass", txtPassword.Text); MySqlDataReader result = comand.ExecuteReader(); if (result != null) { while (result.Read()) { UserControl.userID = (int)result[0]; UserControl.userName = result[1].ToString(); HRMainForm f = new HRMainForm(); f.Show(); } this.Hide(); } else { MessageBox.Show("please try again"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public EmployeesName(HRMainForm HRMainForm) { InitializeComponent(); dbconnection = new MySqlConnection(connection.connectionString); this.HRMainForm = HRMainForm; }