string mac = GetMac(); string Qry = "Select VUserid,Password from passtable where VUserid='" + UserName.Text + "' and Flag='A'"; string qry = "Select VUserid,Password from passtable where Flag='A'"; string strq = "Select Mac_id from Sysinfo Where Appflag='A'"; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EvalCon"].ConnectionString)) { try { SqlCommand cmd = new SqlCommand(Qry, conn); SqlCommand cmd1 = new SqlCommand(qry, conn); SqlCommand cmd2 = new SqlCommand(strq, conn); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(cmd); SqlDataAdapter daa = new SqlDataAdapter(cmd1); SqlDataAdapter dap = new SqlDataAdapter(cmd2); DataTable dt = new DataTable(); DataTable dtt = new DataTable(); DataTable tab = new DataTable(); da.Fill(dt); daa.Fill(dtt); dap.Fill(tab); for (int i = 0; i < tab.Rows.Count; i++) { for (int x = 0; x <= dtt.Rows.Count - 1; x++) { if (mac == tab.Rows[i]["Mac_id"].ToString() || tab.Rows.Count != 0) { if (UserName.Text == dtt.Rows[x]["VUserid"].ToString() && Password.Text == dtt.Rows[x]["Password"].ToString()) { Response.Redirect("~/Changepass.aspx"); break; } else { lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Invalid Username or Password !!!"; } } else { lblMessage.Visible = true; lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Invalid Access Point for Evaluation !!!"; } } } } finally { conn.Close(); conn.Dispose(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)