private void stdntbtn_Click(object sender, EventArgs e)
        {
            this.Hide();
            VerifyStudent f1 = new VerifyStudent();

            f1.Show();
        }
예제 #2
0
        public void readfromdatabase(OleDbConnection connection, string val1, string val2)
        {
            connection.Open();
            try
            {
                OleDbCommand command = new OleDbCommand();
                command.Connection  = connection;
                command.CommandText = "select * from Table1 where ID='" + val1 + "'and Pass='******'";
                OleDbDataReader reader = command.ExecuteReader();
                int             c      = 0;
                while (reader.Read())
                {
                    c = c + 1;
                }
                if (c == 1)
                {
                    MessageBox.Show("Username and Password are Correct");
                    int           a  = 1;
                    VerifyStudent f1 = new VerifyStudent();
                    f1.returnval(a);
                }
                else if (c > 1)
                {
                    MessageBox.Show("Too Many Username of this");
                }
                else
                {
                    MessageBox.Show("Username and Password is not Correct");
                }

                connection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error" + ex);
                connection.Close();
            }
        }