コード例 #1
0
        private void btnsignin_Click(object sender, EventArgs e)
        {
            string user = txtusername.Text;
            string pass = txtpassword.Text;

            try
            {
                MySqlDataReader sdr = conn.viewData("SELECT * FROM user WHERE email='" + txtusername.Text + "' AND password='******'");

                while (sdr.Read())
                {
                    if (user == sdr["email"].ToString() && pass == sdr["password"].ToString())
                    {
                        string position = sdr["position"].ToString();
                        callposition = position;
                        callusername = user;
                        frmdashboard obj = new frmdashboard();
                        obj.Show();
                        this.Hide();
                    }
                    MessageBox.Show("Invalid credentials... Please try Again with valid credentials", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection Error!" + ex, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #2
0
        private void homeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmdashboard obj = new frmdashboard();

            obj.Show();
            this.Hide();
        }