private void btnback_Click(object sender, EventArgs e) { frmadmin frmadmin = new frmadmin(); frmadmin.Show(); this.Dispose(); }
private void btnlogin_Click(object sender, EventArgs e) { if (txtaduserid.Text == "") { MetroMessageBox.Show(this, "\n\nPLEASE ENTER THE USER ID\nTO LOGIN IN ADMIN PANEL\n\n\n\n\n\n\n\n\nCopyright © Venus Foundation", "G. COMPUTERs STUDENT ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information, 387); txtaduserid.Focus(); } else { if (txtadpass.Text == "") { MetroMessageBox.Show(this, "\n\nPLEASE ENTER THE PASSWORD\nTO LOGIN IN ADMIN PANE\n\n\n\n\n\n\n\n\nCopyright © Venus Foundation", "G. COMPUTERs STUDENT ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information, 387); txtadpass.Focus(); } else { try { OleDbCommand cmd = new OleDbCommand("select * from login where userid='" + txtaduserid.Text + "'and password='******'", conclass.con); if (conclass.con.State == ConnectionState.Open) { conclass.con.Close(); } conclass.con.Open(); OleDbDataReader dbreader = cmd.ExecuteReader(); if (dbreader.Read()) { conclass.con.Close(); dbreader.Close(); cmd.Dispose(); this.Hide(); frmadmin.Show(); } else { MetroMessageBox.Show(this, "\n\nPLEASE ENTER RIGHT USER ID AND PASSWORD\nAND TO LOGIN IN THE ADMIN PANEL\n\n\n\n\n\n\n\n\nCopyright © Venus Foundation", "G. COMPUTERs STUDENT ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information, 387); } } catch (Exception exeption) { MessageBox.Show(exeption.Message); } } } }