回复 13# sunfishy 的帖子
大哥不是说有关系,你看啊,比方第一条件加第二条件的结果为10000条,你说要不要分页呢?所以,我要分页,还请大哥指点,还有我有段这样的组合查询代码:
<!--#include file="conn.asp"--><style type="text/css">
<!--
body,td,th {
font-family: 宋体;
font-size: 12px;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style>
<table align="center" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#000000">
<tr bgcolor="#3399FF" align="center">
<td>编号</td>
<td>需求部门</td>
<td>需求人员</td>
<td>需求人电话</td>
<td>需求完成时间</td>
<td>故障标题</td>
<td>执行人</td>
<td>分配完成时间</td>
<td>执行状况</td>
<td>分配情况</td>
<td>详情</td>
</tr>
<%dim rs,sql,nd_depart,years,months,days,times,do_type,nd_data
nd_depart=request("nd_depart")
years=request("years")
months=request("months")
days=request("days")
times=request("times")
do_type=request("do_type")
set rs=server.CreateObject("adodb.recordset")
sql="select * from [nd_msg] where 1=1"
if nd_depart<>"" then
sql=sql&" and nd_depart='"&nd_depart&"'"
end if
if do_type<>"" then
sql=sql&" and do_type='"&do_type&"'"
end if
if years<>"" and months<>"" and days<>"" and times<>"" then
nd_data=years&"-"&months&"-"&days
select case times
case "制单时间"
sql=sql&" and wrt_time='"&nd_data&"'"
case "需求完成时间"
sql=sql&" and nd_data='"&nd_data&"'"
end select
end if
'rs.open sql,conn,1,3
set rs=conn.execute("select * from [nd_msg] "&sql)
do while not rs.eof
'rs.pagesize=10
'page=cint(request("page"))
'if page<=0 then page=1
'if page="" then page=1
'rs.absolutepage=page
%>
<%'for i=0 to rs.pagesize-1
'if rs.eof or rs.bof then exit for
%>
<tr>
<td><%=rs("id")%></td>
<td><%=rs("nd_depart")%></td>
<td><%=left(rs("nd_name"),5)%></td>
<td><%=rs("nd_tel")%></td>
<td><%=rs("nd_data")%></td>
<td><%=left(rs("nd_title"),8)%></td>
<td><%=rs("do_man")%></td>
<td><%=rs("do_time")%></td>
<%if rs("do_type")=1 then%>
<td>已完成</td>
<%else%>
<td>未完成</td>
<%end if%>
<%if rs("agn_type")=1 then%>
<td>已分配</td>
<%else%>
<td>未分配</td>
<%end if%>
<td><a href="viewresult.asp?id=<%=rs("id")%>">详情</a></td>
</tr>
<%rs.movenext()
loop%>
</table>
<%conn.close%>
就那个组合查询部分的代码,你看有问题吗?肯定有,因为查询不出结果,大哥指点下是什么错误吗
谢谢了