예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from library_person where username='******' and password='******'";
            cmd.ExecuteNonQuery();
            DataTable      dt = new DataTable();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            count = Convert.ToInt32(dt.Rows.Count.ToString());
            if (count == 0)
            {
                MessageBox.Show("Invalid Username or Password");

                Form1 f1 = new Form1();
                f1.Show();
            }
            else
            {
                this.Hide();
                mdi_user mu = new mdi_user();
                mu.Show();
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //SqlCommand cmd = con.CreateCommand();
            //cmd.CommandType = CommandType.Text;
            // con.Open();
            string str = "select *from library_person where username='******' and password='******'";

            cmd = new SqlCommand(str, con);
            SqlDataReader dr = cmd.ExecuteReader();

            // DataTable dt = new DataTable();
            // SqlDataAdapter da = new SqlDataAdapter(cmd);
            //da.Fill(dt);
            // count = Convert.ToInt32(dt.Rows.Count.ToString());
            if (dr.Read())
            {
                this.Hide();
                mdi_user md = new mdi_user();
                md.Show();
                dr.Close();
            }
            else
            {
                MessageBox.Show("Username and password does not match");
            }
        }
예제 #3
0
 private void CheckPasswordAndLogin(int AccountId)
 {
     if (AccountId == 0)
     {
         MessageBox.Show("Username and Password doesn't match!");
     }
     else
     {
         this.Hide();
         mdi_user mdiUser = new mdi_user();
         mdiUser.Show();
     }
 }