Beispiel #1
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            MySqlCommand    command;
            MySqlDataReader mdr;
            string          ConnectString = "datasource = localhost; username = root; password=; database = bluster";
            MySqlConnection DBconnect     = new MySqlConnection(ConnectString);

            DBconnect.Open();
            string checkquery = "Select * from info WHERE username= '******' AND password = '******';";

            command = new MySqlCommand(checkquery, DBconnect);
            mdr     = command.ExecuteReader();
            if (mdr.Read())
            {
                MessageBox.Show("Login Successfull!!!");
                this.Hide();
                this.getTress();
                MainFrom mainform = new MainFrom(tress);
                mainform.Show();
            }
            else
            {
                MessageBox.Show("Incorrect Login Information! Try again.");
            }

            DBconnect.Close();

            if (string.IsNullOrEmpty(textBoxUsername.Text) || string.IsNullOrEmpty(textBoxPassword.Text))
            {
                MessageBox.Show("Please input Username and Password", "Error");
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DBconnection();
            this.Hide();
            MainFrom mainform = new MainFrom(tress);

            mainform.Show();
        }