ASP 中 怎么让上个月的报表 在这个月的8号才显示出来啊 高分相送

来源:百度知道 编辑:UC知道 时间:2024/05/21 15:47:27
高手看看 代码怎么写 高分相送
我的情况是这样的 现在要加一个 让pright=40(权限) 的用户 如果其登入时 系统时间比本月8日小,就让查询出来的所有结果的最后一项结果 不显示 原本的代码如下
<%
Sql = "select baobiaoym from "&bb_tablename&" where qyxx_id="&qyxx_id&" group by baobiaoym order by baobiaoym asc"
Set Rs1 = Server.CreateObject ("ADODB.Recordset")
Rs1.Open Sql,Con,3,3
if not Rs1.eof then
niucount=1
countnum=6
while not Rs1.eof
baobiaoym=Rs1("baobiaoym")
if niucount=1 then
%> <tr>
<% end if
%>
<td valign="top"><a href="<%=bb_numble%>_show.asp?qyxx_id=<%=qyxx_id%>&baobiaoym=<%=baobiaoym%>" target="_blank">

<%=baobiaoym%></a></td>
<%
if niucount=countnum then
niucount=0
%> </tr>
<% end if
Rs

你要把你的调用代码写出来,我们才好给你写时间限制的代码啊
写了代码就好分析多了哈!
我理解你的问题是:系统时间比本月8日小,则那个循环读出的记录的最后一条就不会显示出来。如果我没理解错误,那么,下面修改的代码就正好适合你了
<%
Sql = "select baobiaoym from "&bb_tablename&" where qyxx_id="&qyxx_id&" group by baobiaoym order by baobiaoym asc"
Set Rs1 = Server.CreateObject ("ADODB.Recordset")
Rs1.Open Sql,Con,3,3
if not Rs1.eof then
niucount=1
countnum=6
Dim n'修改处
n=0'修改处
while not Rs1.eof
n=n+1'修改处
If (n=rs1.recordcount And datediff("d",DateSerial(Year(Date()),Month(Date()),8),date)>0) Or n<rs1.recordcount then'关键处,意思是:如果记录是最后一条和时间是本月8之外,或者记录不是最后一条,就允许输出以下东西,否则(即记录是最后一条,而且系统时间比本月8日小),这个循环的内容就不输出了。
baobiaoym=Rs1("baobiaoym")
if niucount=1 then
%> <tr>
<% end if
%>
<td valign="top"><a href="<%=bb_numble%>_show.asp?qyxx_id=<%=qyxx_id%>&baobiaoym=<%=baobiaoym%>&