protected void ValidateUserInfo(string user, string pass) { string EmpId = txtempid.Text; string designation = Designationddl.Text; SqlConnection con = null; string strConn = "Data Source=.;Initial Catalog=db_employee;User ID=sa;Password=;"; con = new SqlConnection(strConn); con.Open(); string sql = "select * from employees where EMPID=@EmpID and PASSWORDE=@Passworde"; SqlCommand cmd = new SqlCommand(sql, con); cmd.Parameters.AddWithValue("@EmpID", user); cmd.Parameters.AddWithValue("@Passworde", pass); SqlDataAdapter ad = new SqlDataAdapter(cmd); ad.Fill(dt); SqlDataReader sqlRead = cmd.ExecuteReader(); if (sqlRead.Read()) { Session["EMPID"] = sqlRead["EMPID"]; } if (dt.Rows.Count > 0) { Response.Redirect("employeePage.aspx"); } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('Invalid Username and Password')</script>"); txtempid.Text = ""; txtpwd.Text = ""; } con.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)