SqlConnection con=new SqlConnection(@"Data Source=ashish-pc\;Initial Catalog=HMS;Integrated Security=True"); con.Open(); SqlCommand cmd = new SqlCommand("select * from Login where UserName=@UserName and Password=@Password", con); cmd.Parameters.AddWithValue("@UserName", UserName.Text.Trim() ); cmd.Parameters.AddWithValue("@Password", Password.Text.Trim()); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; // DataSet dt = new DataSet(); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count>0) { Session["UserName"] = UserName.Text; Session.Timeout = 10; if (dt.Rows[0]["SuperUser"].ToString() == "True") { Response.Redirect("/Home.aspx"); } else { Response.Redirect("/Appointment.aspx"); } } else { Response.Write("Invalid username and password"); } con.Close(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)