标题:【求助】在对应所需名称或序数的集合中,未找到项目。
取消只看楼主
qzwenwen
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-1-24
结帖率:0
已结贴  问题点数:20 回复次数:1 
【求助】在对应所需名称或序数的集合中,未找到项目。
我是制作一个日志管理系统,rizhi 是存日志的表, admin是用户名表 news_list.asp是日志清单页,具体代码如下,就是测试的时候提示在对应所需名称或序数的集合中,未找到项目,第 241 行 用红色标出
试了很多办法都没搞定,请教各位哥哥姐姐帮忙。

<!--#include file="../conn.asp"-->
<%    if session("id")="" then
    response.write "<script language='javascript'>"
    response.write"parent.location.href='../../default.asp';</SCRIPT>"
    response.end
    end if
    username=session("username")
    userid=session("id")
    flag=session("flag")
    xm=session("xm")
   userbm=session("userbm")
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<html xmlns="http://www.
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" >
   <head>
<style type="text/css">
body{ text-align:center; font-family:宋体; font-size:12px; color:inherit;margin-left:4px;}
#top{ width:950px; height:61px; bottom:0; border-bottom:solid 4px #0A94D6}
.logo{ width:240px; height:48px; margin-top:5px; float:left; text-align:left}
.topright{
        float: right;
        margin-top: 25px;
        width: 700px;
        height: 20px;
        text-align: right;
        float: left;
        color: #000080;
    }
.topright a{color: #000080;font-family:宋体; font-size:12px;text-decoration : none }
.dh{ width:780px; margin-top:25px;}
.dha{
          margin-left: 60px;
          width: 138px;
          height: 27px;
          float: left;
          margin-right: 20px;
      }
.dha1{ width:9px; height:27px; float:left; background:url(../images/1.jpg);}
.dha2{  font-weight: normal;
        font-size: 14px;
        width: 121px;
        height: 27px;
        float: left;
        background: url(../images/2.jpg);
        color: #FFFFFF;
    }
.dha21{
        float:left;
        text-align:center;
        width:121px;
        line-height:27px;

    }
.dha3{ width:8px; height:27px; float:left; background:url(../images/3.jpg);}
.dhb{ width:140px;
float:left; height:23px; margin-left:0px; padding-top:0px
    }
.dhb1{
        width: 120px;
        float: left;
        color: #666666;
        font-size: 14px;
         margin-top:6px;
         text-align:left; text-align:left; margin-left:60px;
    }
.dhb2{
        width: 120px;
        float: left;
        color: #666666;
        font-size: 14px;
         margin-top:6px;
         text-align:left;
         margin-left:20px;
    }
.dhc{
        width: auto;
        float: right;
        color: #FF0000;
        padding-top: 7px;
    }
.dhz{ width:780px; border:solid 1px #0A94D6; background-color:#ffffff;
     float:left; padding-bottom:20px; padding-top:10px;position:relative; }
.dhza{position:relative;
    background:#bbb;
    margin:5px 0px 0px 0px ;
    width:780px; height:320px;}
     
.form{ width:700px; font-size:14px; padding-left:0px; margin-bottom:40px;}
#xsnazzy h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px;}
#xsnazzy h1 {font-size:2.5em; color:#fff;}
#xsnazzy h2 {font-size:2em;color:#06a; border:0;}
#xsnazzy p {padding-bottom:0.5em;}
#xsnazzy h2 {padding-top:0.5em;}
#xsnazzy1 h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px; }
#xsnazzy1 h1 {font-size:2.5em; color:#fff;}
#xsnazzy1 h2 {font-size:2em;color:#06a; border:0;}
#xsnazzy1 p {padding-bottom:0.5em;}
#xsnazzy1 h2 {padding-top:0.5em;}
#xsnazzy
{     width:700px;  float:left;
        background: #FFFFFF;
        margin: 1em; margin-right:60px;
        
    }
#xsnazzy1 { width:700px;float:left;
        background: #FFFFFF;
        margin: 1em;
    }

.xtop, .xbottom {display:block; background:transparent; font-size:1px;}
.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}
.xb1, .xb2, .xb3 {height:1px;}
.xb2, .xb3, .xb4 {background:#FFF; border-left:1px solid #08c; border-right:1px solid #08c;}
.xb1 {margin:0 5px; background:#08c;}
.xb2 {margin:0 3px; border-width:0 2px;}
.xb3 {margin:0 2px;}
.xb4 {height:2px; margin:0 1px;}

.xboxcontent {
        display: block;
        background: #FFFFFF;
        border: 0 solid #08c;
        border-width: 0 1px;
    }
.lianjie{ float:left; font-size:12px;float:left; width:200px; text-align:left;}
.lianjie a{ font-size:12px;text-decoration : none }
.lianjie1{ float:left; font-size:12px;float:left; width:290px; text-align:center; height:50px;padding-top:20px;}
.lianjie1 a{ font-size:12px;text-decoration : none }
.lianjie2{ width:280px; text-align:center; font-size:14px;}
.lianjie2 a {font-size:14px;text-decoration : none ; border:none;}
.lianjie2 a link{font-size:14px;text-decoration : none ; border:none;}
.lianjie2 a hover{font-size:14px;text-decoration : none ; border:none;}
.lianjie2 a visited{font-size:14px;text-decoration : none ; border:none;}
.lianjie2 img{ width:280px; text-align:center; font-size:14px;text-decoration : none ; border:0px;}
#csd a{ font-size:12px; font-family:宋体, Arial, Helvetica, sans-serif; text-decoration:none;
   color:#663300}
   
</style>
<script src="../inc/ShowCalendar.js"></script>
</head>
<body>

    <div class="dh">
个人日志管理
<br><br>
<div align="dh"><table width="100%" cellpadding="0" cellspacing="0">
  <TR>
    <TD width="*">
    <%
        if session("flag")=2 or session("flag")=1 then
    %>
   
    搜索用户:
    <select name="username">
                    <option value="">日志检索</option>
<%                    
if flag=1 then
sql="select * from admin  order by id desc"
else
if flag=2 then
sql="select * from admin where userbm="&userbm&" order by id desc"
end if  
end if                    
 set rs=conn.execute(sql)'111
 while not rs.eof'11
%>
                    
                    
                    <option value="<%=rs("username")%>"<%if rs("username")=request.QueryString("username") then%> selected<%end if%>><%=rs("xm")%></option>
<%
rs.movenext'1111
    wend
    rs.close'1111
%>   
      </SELECT>
      <%end if%>
     
    日期:从
    <input name="startDate" type="text" id="startDate" size="10"  onClick="javascript:ShowCalendar('startDate')" value="<%=request.QueryString("startDate")%>"> <img src="../images/date1.jpg" width="20" height="17" style="cursor:hand;"  onClick="javascript:ShowCalendar('startDate')">
    到   
    <input name="endDate" type="text" id="endDate" size="10"  onClick="javascript:ShowCalendar('endDate')"  value="<%=request.QueryString("endDate")%>"> <img src="../images/date2.jpg" width="20" height="17" style="cursor:hand;"  onClick="javascript:ShowCalendar('endDate')">
    <input name="button" type="submit" class="button" id="button" onClick="location.href='news_list.asp?startDate='+document.all.startDate.value+'&endDate='+document.all.endDate.value<%if session("flag")=2 or session("flag")=1 then%>+'&username='+document.all.username.options[document.all.username.selectedIndex].value<%end if%>" value="搜索"></TD>
  </TR>
</table></div>
         <div class="dhz"><div class="form" style="width:730px; height:300px; text-align:center">
<%
if session("flag")=3 then
    wherestr=" and a.username='"&session("username")&"'"  
    end if
    if isdate(request("startDate")) then
    wherestr=wherestr&" and  datediff('d',a.rzsj,'"&request("startDate")&"')<=0"  
    end if
   
    if isdate(request("endDate")) then
    wherestr=wherestr&" and  datediff('d',a.rzsj,'"&request("endDate")&"')>=0"  
    end if
    if session("flag")=2 or session("flag")=1 then
        if request("username")<>"" and request("username")<>"0" then
        wherestr=wherestr&" and  a.username='"&request("username")&"'"  
        end if
    end if




sql="select a.id,a.rzsj,a.username from [rizhi] a left join [admin] b on a.username=b.username where 1=1 "&wherestr&" order by a.id desc"


set rs=server.CreateObject("adodb.recordset")
    rs.open sql,conn,1,1
    rs.pagesize=10
    currentPage=Request.QueryString("page")
    if not isnumeric(currentPage) then
        currentPage=1
    end if
    currentPage=cint(currentPage)
    if currentPage<1 then
        currentPage=1
    end if
    if currentPage>rs.pagecount then
        currentPage=rs.pagecount
    end if
    PageCounts=rs.pagecount
    recordCounts=Rs.RecordCount
    if not rs.eof then
        rs.absolutepage=currentPage
    for i=1 to rs.pagesize
    if rs.eof then exit for
    %>





<div  style="width:20px; text-align:center; font-size:12px; float:left; background-color: #ffffff;font-weight:normal;height:25px;padding-top:5px;border-bottom:none; border-right:none;margin-left:15px; border-bottom:1px #0A94D6 solid;">
<img src="../../Skins/1year/images/index/list_icon.gif"> </div>
<div id="csd" style="width:678px; text-align:left; font-size:12px; float:left; background-color: #ffffff;font-weight:normal;height:25px;padding-top:5px;border-bottom:1px #0A94D6 solid; padding-left:0px; overflow:hidden; ">
     就是下面这行“第 241 行”提示出错
<a href="news_show.asp?id=<%=rs("id")%>" ><%=rs("rzname")%></a><font color="maroon">(<%=rs("rzsj")%>)</font>
     <%if rs("username")=username or flag=1  then%>    <a href="edit.asp?id=<%=rs("id")%>">修改</a>   |   <a href="del.asp?id=<%=rs("id")%>" >删除</a>
<%end if%>     
      <%if flag=2 and rs("userbm")=userbm  then%>    <a href="edit.asp?id=<%=rs("id")%>">修改</a>   |   <a href="del.asp?id=<%=rs("id")%>" >删除</a>
<%end if%></div>
<div  style="width:0px; text-align:center; font-size:12px; float:left; background-color: #ffffff;font-weight:normal;height:25px;padding-top:5px;">
    </div>
<div  style="width:2px; text-align:center; font-size:12px;  float:left; background-color: #ffffff; font-weight:normal;height:25px; padding-top:5px; ">
</div>

<%
    rs.movenext
    next
    end if
    rs.close
    conn.close
%>
<div  style="width:700px; text-align:center; font-size:12px;  float:left; background-color: #ffffff; height:25px; padding-top:5px;; background-color: #F1F9FC; margin-left:15px; font-weight:normal; margin-top:15px;">
<%call listPages()%></div>


</div><a href="add_news.asp"> 添加新日志</a></div></div>
   
   </div>
</body>
</html>
<%


sub listPages()
   if not (rs.eof and rs.bof) then
    gopage=currentpage
    totalpage=n
    blockPage=Int((gopage-1)/10)*10+1
    if blockPage = 1 Then
        Response.Write "<font color=#000>【←前10页&nbsp;&nbsp;"
    Else
        Response.Write("<span disabled>【</span><a href=news_list.asp?page="&blockPage-10&">←前10页</a>&nbsp;&nbsp;")
    End If
   i=1
   Do Until i > 10 or blockPage > n
    If blockPage=int(gopage) Then
        Response.Write("<font color=#FF0000>[<b>"&blockPage&"</b>]</font>")
    Else
        Response.Write("<a href=news_list.asp?page="&blockPage&">["&blockPage&"]</a>")
    End If
    blockPage=blockPage+1
    i = i + 1
    Loop
    if blockPage > totalpage Then
        Response.Write "&nbsp;&nbsp;<font color=#000>后10页→】</font>"
    Else
        Response.Write("&nbsp;&nbsp;<a href=news_list.asp?page="&blockPage&">后10页→</a><span disabled>】")
    End If
        Response.Write("&nbsp;&nbsp;<font color=#000>共</font><font color=red>"&n&"</font><font color=#000>页 每页</font><font color=red>"&msg_per_page&"</font><font color=#000>条记录 共</font><font color=red>"&totalrec&"</font>条记录")
end if
end sub
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

[ 本帖最后由 qzwenwen 于 2013-1-24 14:42 编辑 ]
搜索更多相关主题的帖子: include admin file 
2013-01-24 14:37
qzwenwen
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2013-1-24
得分:0 
回复 2楼 ysf0181
版主。数据库字段检查过后全部都有的。
2013-01-24 15:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-397494-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.267444 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved