Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- panel3.BackColor = Color.FromArgb(144, 144, 144);
- SqlConnection conn = new SqlConnection();
- conn.ConnectionString = @"Data Source=Desktop-D8FP0VA;Initial Catalog=cms;Integrated Security=True";
- conn.Open();
- SqlDataAdapter da;
- DataTable dt;
- using (da = new SqlDataAdapter
- ("select Username,Password from Admin where Password='" + password.Text + "' and Username ='" + textBox3.Text + "'", conn))
- {
- dt = new DataTable();
- da.Fill(dt);
- }
- if (dt.Rows.Count > 0)
- {
- this.Visible = false;
- Home h = new Home();
- h.Show();
- }
- else {
- MessageBox.Show("Invalid Username or Password");
- }
- conn.Close();
- textBox3.Text = "";
- password.Text = "";
- }
Add Comment
Please, Sign In to add comment