Exemplo n.º 1
0
        private void LoginB_Click(object sender, EventArgs e)
        {
            SqlConnection  con = new SqlConnection(@"Data Source=DESKTOP-I2JB8K5;Initial Catalog=Login;Integrated Security=True");
            SqlDataAdapter sda = new SqlDataAdapter("select count(*) from Login_tb where User_Name='" + UNbox.Text + "' and Password= '******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                Homepage hmpage = new Homepage();
                hmpage.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Please Check your UserName and Password!", "aleart", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }