日期:2014-05-17  浏览次数:20964 次

不提交表单就出现查询结果的奇怪问题。
小弟初学asp,做了个查询表单,使用三个查询条件,为实现模糊,代码如下:
<%
dim   rs3
dim   sql3

set   rs3=server.createobject( "adodb.recordset ")
sql3   =   "select   *   from   ziliao   "
rs3.open   sql3,MM_conn_STRING,1,1
%>
<%
dim   timeid
dim   placeid
dim   name
timeid=request.QueryString( "timeid ")
palceid=request.QueryString( "placeid ")
name=request.QueryString( "name ")
%>
<%
if   trim(timeid)= " "   and   trim(placeid)= " "   and   trim(name)= " "   then
          sql= "select   *   from   ziliao   "
    end   if
    if   trim(timeid)= " "   and   trim(placeid)= " "   and   trim(name) <> " "   then
          sql= "select   *   from   ziliao   where   name   like   '% "&trim(name)& "% '   "
    end   if
    if   trim(timeid)= " "   and   trim(placeid) <> " "   and   trim(name)= " "   then
          sql= "select   *   from   ziliao   where   placeid   like   '% "&trim(placeid)& "% '   "
    end   if
    if   trim(timeid)= " "   and   trim(placeid) <> " "   and   trim(name) <> " "   then
          sql= "select   *   from   ziliao   where   placeid   like   '% "&trim(placeid)& "% '   and   name   like   '% "&trim(name)& "% '   "
    end   if
    if   trim(timeid) <> " "   and   trim(placeid)= " "   and   trim(name)= " "   then
          sql= "select   *   from   ziliao   where   timeid   like   '% "&trim(placeid)& "% '   "
    end   if
    if   trim(timeid) <> " "   and   trim(placeid)= " "   and   trim(name) <> " "   then
          sql= "select   *   from   ziliao   where   timeid   like   '% "&trim(timeid)& "% '   and   name   like   '% "&trim(name)& "% '   "
    end   if
    if   trim(timeid) <> " "   and   trim(placeid) <> " "   and   trim(name)= " "   then
          sql= "select   *   from   ziliao   where   timeid   like   '% "&trim(timeid)& "% '   and   placeid   like   '% "&trim(placeid)& "% '   "
    end   if
    if   trim(timeid) <> " "   and   trim(placeid) <> " "   and   trim(name) <> " "   then
      &nb