示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (isValidate())
            {
                string        constr = ConfigurationManager.ConnectionStrings["dbpath"].ConnectionString;
                SqlConnection con    = new SqlConnection(constr);
                con.Open();
                string     query = "SELECT * from user_info where username = @u and password = @p";
                SqlCommand cmd   = new SqlCommand(query, con);
                cmd.Parameters.Add(new SqlParameter("u", txtUsername.Text));
                cmd.Parameters.Add(new SqlParameter("p", txtPassword.Text));

                SqlDataReader dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    this.Hide();
                    FeeForm ff = new FeeForm();
                    ff.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Invalid Username or Password", "Authentication Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPassword.Clear();
                    txtPassword.Focus();
                }
                con.Close();
            }
        }
示例#2
0
        private void addStudentFeeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FeeForm ff = new FeeForm();

            ff.ShowDialog();
        }