日期:2014-05-16 浏览次数:20448 次
protected void CX_Click(object sender, EventArgs e)
{
//这个打开就直接提示型号不能为空
//if (this.XH.Text == “” && this.XH.Text.Length == 0)
// {
// Response.Write("<script>alert('型号不能为空')</script>");
// }
//走到这里的时候条件就跳到else里面了.但是我XH里面什么都没有
if (this.XH.Text == null && this.XH.Text.Length == 0)
{
Response.Write("<script>alert('型号不能为空')</script>");
}
else
{
DB db = new DB();
string sqlstr = "select ID,category,varieties,type,color,layer,thickness,SPECIFICATION,METER,Square,Data,Number,Remark,Nmb FROM category,varieties,color,layer,thickness,kc where kc.CategoryID = '" + this.LB.SelectedValue + "'and kc.VarietiesID = '" + this.PP.SelectedValue + "' AND kc.ColorID = '" + this.HS.SelectedValue + "'AND kc.LayerID = '" + this.NMC.SelectedValue + "' and kc.ThicknessID = '" + this.HD.SelectedValue + "'and kc.type like '%" + this.XH.Text + "%' and kc.Number >= '" + this.KC1.Text + "'and Category.CategoryID=kc.CategoryID and Varieties.VarietiesID=kc.VarietiesID AND Color.ColorID=kc.ColorID AND Layer.LayerID = kc.LayerID and Thickness.ThicknessID = kc.ThicknessID ORDER BY KC.ID ASC LIMIT " + (page - 1) * count + "," + count;
DataTable dt = db.reDt(sqlstr);
XS.DataSource = dt;
XS.DataBind();
if (XS.DataKeys == null)
//这个改怎么判断呢?我用的是GridView
{
Response.Write("<script>alert('没有此类型')</script>");
}
}