Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from   Person where Username ='******' and password ='******' ";
            cmd.ExecuteNonQuery();

            DataTable      dt      = new DataTable();
            SqlDataAdapter adapter = new SqlDataAdapter(cmd);

            adapter.Fill(dt);
            count = Convert.ToInt32(dt.Rows.Count.ToString());

            //Login Logic
            if (count == 0)
            {
                MessageBox.Show("Username or Password does not match");
            }

            else
            {
                this.Hide();
                mdi_user mu = new mdi_user();
                mu.Show();
            }
        }
Esempio n. 2
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Select * from Login_Details where Username='******' and Password='******'";
            cmd.ExecuteNonQuery();
            DataTable      data = new DataTable();
            SqlDataAdapter sda  = new SqlDataAdapter(cmd);

            sda.Fill(data);
            count = Convert.ToInt32(data.Rows.Count.ToString());
            if (count == 0)
            {
                MessageBox.Show("Wrong Password");
            }
            else
            {
                this.Hide();
                mdi_user mu = new mdi_user();
                mu.Show();
                MessageBox.Show("Login Successful");
            }
        }