Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try {

                MySqlConnection myConn = DB.GetDB();
                // MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
                MySqlCommand SelectCommand = new MySqlCommand ("select * from library.login_credential where username='******' and password='******';", myConn);
                MySqlDataReader myReader;

                myConn.Open ();
                //  DataSet ds = new DataSet();
                myReader = SelectCommand.ExecuteReader ();
                int count = 0;
                while (myReader.Read ()) {
                    count++;
                }

                if (count == 1) {
                    if (int.Parse (myReader.GetString ("id")) < 500) {
                        MainMenu f1 = new MainMenu ();
                        f1.Visible = true;
                        this.Hide ();
                    } else {
                        BorrowerMenu f1 = new BorrowerMenu (myReader.GetString ("id"));
                        f1.Visible = true;
                        this.Hide ();
                    }
                } else {
                    MessageBox.Show ("Incorrect username/password");
                }

                myConn.Close ();

            } catch (Exception ex) {
                MessageBox.Show (ex.Message);
            }
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     BorrowerMenu f = new BorrowerMenu (id);
     f.Visible = true;
     this.Close ();
 }