Ejemplo n.º 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string        query = "Select * From Login Where UserName ='******' And Password = '******'";
            SqlConnection conn  = new SqlConnection(connectionString);

            SqlDataAdapter adapter = new SqlDataAdapter(query, conn);
            DataTable      dt      = new DataTable();

            adapter.Fill(dt);

            if (dt.Rows.Count == 1)
            {
                MasterPage mPage = new MasterPage();
                mPage.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Incorrect Credentials");
                tbxUName.Clear();
                tbxPword.Clear();
                tbxUName.Focus();
            }
        }