コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            A_dasboard a = new A_dasboard();

            a.Show();
            this.Hide();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                c.Open();
                SqlCommand    q  = new SqlCommand("Select UserName,Password,AdminID from Admin where UserName= '******' and Password='******' ", c);
                SqlDataReader dr = q.ExecuteReader();
                if (dr.Read())
                {
                    if (dr["UserName"].ToString() == this.textBox1.Text && dr["Password"].ToString() == this.textBox2.Text)
                    {
                        A_ID = dr["AdminID"].ToString();
                        A_dasboard a = new A_dasboard();
                        a.Show();
                        this.Hide();
                    }
                }
                else
                {
                    MessageBox.Show("Wrong User Name and Password.", "Important Note", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
                }

                c.Close();
            }
            catch (Exception err)
            {
                MessageBox.Show("SomethingWron Here Plz Contact Your Developer" + err, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button2);
            }
        }