Example #1
0
        private void loginButton_Click_1(object sender, EventArgs e)
        {
            try
            {
                string myConnection = "datasource=localhost;port=3306;database=pharma;username=root;password="******"SELECT * FROM pharma.users WHERE username='******' and password='******' ; ", myConn);

                MySqlDataReader myReader;
                myConn.Open();
                myReader = SelectCommand.ExecuteReader();

                int count = 0;
                while (myReader.Read())
                {
                    count = count + 1;
                }
                if (count == 1)
                {
                    MessageBox.Show("User name and Password is correct ..Access Granted");
                    this.Hide();
                    frmMain mainForm = new frmMain();
                    mainForm.ShowDialog();
                }
                else if (count > 1)
                {
                    MessageBox.Show("Duplicate User Name and Password ...Access Denied");
                }
                else
                    MessageBox.Show("User Name and Password is Not Correct ..Please Try Again");
                myConn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
 private void GuestLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     frmMain f = new frmMain();
     f.Show();
     this.Hide();
 }