private void button3_Click(object sender, EventArgs e) { this.Hide(); Choice_Operation cs = new Choice_Operation(); cs.Show(); }
private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text)) { textBox1.Focus(); errorProvider1.SetError(textBox1, "Please Enter User Name"); } if (string.IsNullOrEmpty(textBox2.Text)) { textBox2.Focus(); errorProvider1.SetError(textBox2, "Please Enter User Name"); } SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\AISH GUPTA\Documents\placementdb.mdf;Integrated Security=True;Connect Timeout=30"); SqlDataAdapter sda = new SqlDataAdapter("select count(*) from Login where username ='******' and password='******'", conn); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Hide(); Choice_Operation co = new Choice_Operation(); co.Show(); } else { MessageBox.Show("Please enter correct Username and Password", "alert", MessageBoxButtons.OK, MessageBoxIcon.Error); } }