Exemple #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            StaffPage s1 = new StaffPage(s2);

            s1.Show();
            this.Hide();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Server=.\\SQLEXPRESS; Database= ExamManager;Integrated Security =true");

            conn.Open();
            query = "'" + textBox1.Text + "'";
            SqlCommand    cmd = new SqlCommand("select staffpass from login where staffuname=" + query + "", conn);
            SqlDataReader dr  = cmd.ExecuteReader();

            if (dr.Read())
            {
                if ((textBox2.Text.ToString() == dr.GetString(0).ToString()))
                {
                    StaffPage s1 = new StaffPage(textBox1.Text.ToString());
                    s1.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Incorrect Password");
                }
            }
            conn.Close();
        }