62,074
社区成员
发帖
与我相关
我的任务
分享
try
{
try
{
brand = Request.QueryString["brand"].Trim();
price = Request.QueryString["price"].Trim();
graphics = Request.QueryString["graphics"].Trim();
size = Request.QueryString["size"].Trim();
}
catch (Exception exone)
{
}
DataConn Conn = new DataConn();
if (brand == "" && price == "" && size == "" && graphics == "")
{
sql = "select * from TB_Laptop";
Response.Write("<script>alert('!!!')</script>");
}
else
{
Response.Write("<script>alert('!!!')</script>");
try
{
sql = "select * from TB_Laptop where Type='laptop'";
if (brand != "")
sql += " and SearchBrand='" + brand + "'"; //从这里开始后面的就不执行了。。
Response.Write("<script>alert('1" + sql + "')</script>");
if (price != "")
sql += " and SearchPrice='" + price + "'";
Response.Write("<script>alert('2" + sql + "')</script>");
if (size != "")
sql += " and SearchSize='" + size + "'";
Response.Write("<script>alert('3" + sql + "')</script>");
if (graphics != "")
sql += " and SearchGraphics='" + graphics + "'";
Response.Write("<script>alert('4" + sql + "')</script>");
}
catch (Exception extwo) {
Response.Write("<script>alert('" + extwo.Message + "')</script>");
}
}
Response.Write("<script>alert('!!!')</script>");
Conn.ExcuteSearch(sql);
DT = new DataTable();
DT = Conn.MyDT;
if (DT.Rows.Count < 1)
{
Response.Write("<script>alert('抱歉,我们暂时还未收录您所筛选的商品!感谢您对我们的支持!')</script>");
}
else
{
DataList1.DataSource = DT;
DataList1.DataBind();
}
}
catch (Exception ex) {
Response.Write("<script>alert('"+ex.Message+"')</script>");
}