private void button4_Click(object sender, EventArgs e) { try { con = new SqlConnection("Data Source=.;Initial Catalog=DSIIDC2;Integrated Security=True"); cmd = new SqlCommand("select * from login where username='" + txtusername.Text + "' and password='" + txtpassword.Text + "' and role='admin01'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable datatab = new DataTable(); da.Fill(datatab); if ("admin" == txtusername.Text && "dsiidc" == txtpassword.Text && "admin01" == "admin01") { //Session["userone"] = TextBox1.Text; frm2.Show(); } else if (("admin" == txtusername.Text && "admin" == txtpassword.Text && "admin02" == "admin02")) { ad.Show(); da.Dispose(); } else { txtpassword.Text = ""; txtpassword.Text = ""; } } catch (Exception ex) { MessageBox.Show("Please Enter User name and password"); } }
frm2.Show()
MessageBox.Show
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)