private void button1_Click(object sender, EventArgs e) { USERMAIN1 us = new USERMAIN1(); this.Hide(); us.ShowDialog(); }
private void toCheckStatus() { sql = "SELECT * FROM tbaccount WHERE username = '******'"; sql_cmd = new MySqlCommand(sql, clsMySQL.sql_con); MySqlDataReader rd = sql_cmd.ExecuteReader(); while (rd.Read()) { status = rd["status"].ToString(); } rd.Close(); if (status == "Active") { MessageBox.Show("You have successfully login"); clsMySQL.usern = usern; sql = "INSERT INTO tbhistory(timeanddate,activity,username)VALUES(now(),'Login','" + clsMySQL.usern + "')"; sql_cmd = new MySqlCommand(sql, clsMySQL.sql_con); sql_cmd.ExecuteNonQuery(); USERMAIN1 m = new USERMAIN1(); this.Hide(); m.ShowDialog(); } else if (status == "Not Active") { MessageBox.Show("Your account has been deactivated by the admin"); } }