Exemple #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            new_connection.Dispose();
            new_connection.Close();
            GC.Collect();
            Close();

            this.Hide();

            pos_interface PI = new pos_interface();

            PI.ShowDialog();
        }
Exemple #2
0
        private void Login_button_Click(object sender, EventArgs e)
        {
            new_connection.Open();
            OleDbCommand verification_command = new OleDbCommand();

            verification_command.Connection  = new_connection;
            verification_command.CommandText = "select * from cred where username= '******' and password='******' ";
            OleDbDataReader helper = verification_command.ExecuteReader();

            int counter = 0;

            while (helper.Read())
            {
                counter = counter + 1;
            }

            // checking if the username or password is correct.
            if (counter >= 1)
            {
                MessageBox.Show("Username and password is correct");
                new_connection.Close();   // If the password is correct than close the current form and go to the next one.
                new_connection.Dispose(); // It release all the information from this form
                this.Hide();              // Hiding the current form

                pos_interface PI = new pos_interface();
                PI.ShowDialog();
            }

            //IF incorrect password
            else
            {
                MessageBox.Show("Password is incorrect");
            }

            //Closing connection is always good
            new_connection.Close();
        }