Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnLogin_Click(object sender, EventArgs e)
- {
- SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\Lenovo\Desktop\Visual Studio labsheet 2nd\ProjectP\ProjectP.mdf;Integrated Security=True");
- SqlDataAdapter sqa = new SqlDataAdapter("Select count (*) From tblLogin where Username = '" + txtUser.Text + "' and Password = ' "+ txtPass.Text + "'", con);
- DataTable dt = new DataTable();
- sqa.Fill(dt);
- if (dt.Rows[0][0].ToString()=="1")
- {
- this.Hide();
- MainMenu main = new MainMenu();
- main.Show();
- }
- else
- {
- MessageBox.Show("Username/Password is incorrect. Try again.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement