private void button1_Click(object sender, EventArgs e) { try { SqlConnection con = new SqlConnection(@"Data Source=PRAGEETH\SQLEXPRESS;Initial Catalog=pt_login_now;Integrated Security=True"); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From [dbo].[Login] where USERNAME='******'and PASSWORD='******'", con); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() == "1") { this.Show(); Main_Page ss = new Main_Page(); ss.Show(); } else { MessageBox.Show("Please Check your username and Password", "Polkotuwa Stores", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void mainToolStripMenuItem_Click(object sender, EventArgs e) { Main_Page bp = new Main_Page(); bp.Show(); }