private void btnback_Click(object sender, EventArgs e) { start f1 = new start(); f1.Show(); this.Hide(); }
public void logincla() { if (txtuser.Text == db.userid.ToString() && txtpass.Text == db.passw.ToString()) { MessageBox.Show("F**k you Hacker!!!"); txtpass.Text = ""; txtuser.Text = ""; } else { try { db.condb.Open(); string sqlqery = "SELECT count(*) FROM mattiinventory.tblusers where uname='" + txtuser.Text + "' and pword= '" + txtpass.Text + "' "; MySqlDataAdapter adp = new MySqlDataAdapter(sqlqery, db.condb); DataTable dt = new DataTable(); adp.Fill(dt); db.condb.Close(); if (txtuser.Text == "" || txtpass.Text == "") { MessageBox.Show("Wrong Credentials"); } if (dt.Rows[0][0].ToString() == "1") { db.condb.Open();; string query21 = "SELECT fname,lname,level FROM mattiinventory.tblusers WHERE uname = '" + txtuser.Text + "' "; MySqlCommand cmd21 = new MySqlCommand(query21, db.condb); MySqlDataReader myread21 = cmd21.ExecuteReader(); while (myread21.Read()) { useridmon = myread21.GetString(0) + " " + myread21.GetString(1); userlevel = myread21.GetString(2); } db.condb.Close(); MessageBox.Show("Login Success\nThank you for using \nthe software!!\n\n- Developer ", "Inventory System Alert!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); start f = new start(); f.Show(); db.condb.Close(); } else { db.condb.Close(); txtpass.Text = ""; txtuser.Text = ""; txtuser.Focus(); MessageBox.Show("Wrong Credentials!!", "Inventory System Alert", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err) { MessageBox.Show(err.ToString()); } } }