Example #1
0
        private void login_Click(object sender, EventArgs e)
        {
            con.Open();
            OleDbCommand command = new OleDbCommand();

            command.Connection  = con;
            command.CommandText = "select * from Users where Username='******'and Password='******'";
            OleDbDataReader reader = command.ExecuteReader();
            int             count  = 0;

            while (reader.Read())
            {
                x = Convert.ToString(reader["User"]);
                count++;
            }
            if (count == 1)
            {
                Form1 f1 = new Form1(x);
                f1.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Incorrect Username or Password!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);


                Passwordtxtbox.Clear();
                con.Close();
            }
        }
Example #2
0
 private void login_Click(object sender, EventArgs e)
 {
     if (idtxtbox.Text == "admin" && Passwordtxtbox.Text == "admin")
     {
         Form4 f = new Form4();
         f.Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show("Invalid User Name and Password", "Error");
         Passwordtxtbox.Clear();
     }
 }