| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 864 人关注过本帖
标题:少个条件语句要怎么写呀?/
只看楼主 加入收藏
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
收藏
 问题点数:0 回复次数:3 
少个条件语句要怎么写呀?/
分页了.但是显示了25条之后的数据,是不是在红色处少条件呀??
<html>
<head>
<title>十五管理</title>
</head>
<%
set conn=server.createobject("adodb.connection")
DSNtemp = "Driver={Microsoft Access Driver (*.mdb)};"
DSNtemp = DSNtemp & "DBQ=" & server.mappath("/swd/date/student.mdb")
conn.open DSNtemp
stext = "select * from stu order by banji desc"
set rs = conn.execute(stext)
if rs.eof then
response.write "database error"
response.end
end if
%>
<%
'set conn=server.createobject("adodb.connection")
'conn.open("DRIVER=Driver do Microsoft ACCESS (*.mdb);dbq="&server.mappath("student.mdb"))
set rs=server.createobject("adodb.recordset")
sql="select * from stu"
rs.open sql,conn,3
rs.pagesize=25
if request("page")<>"" then
  epage=cint(request("page"))
   if epage<1 then epage=1
   if epage>rs.pagecount then epage=rs.pagecount
else
epage=1
end if
rs.absolutepage=epage
%>

<body>
<!--页面左边开始-->  <form name="form1" method="post" action="/swd/ss_zy.asp">
  相关操作:
 <a href="#">量化细则</a></font> | <a href="file:///f|/%d0%c2%bd%a8%ce%c4%bc%fe%bc%d0%20(2)/mybbs/swd/index.asp">所有学员</a>
  | <a href="file:///f|/%d0%c2%bd%a8%ce%c4%bc%fe%bc%d0%20(2)/mybbs/swd/index1.asp">后台管理</a> </font>
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
    <td>姓名
      <input name="xingming" type="text" maxlength="10" size="15">
      班级
      <input name="banji" type="text" maxlength="10" size="15"> <input name="submit" type="submit" value="显示学员">
    </td>
  </form>
</div>
<!--页面左边结束-->
<!--页面右边开始-->
    <table width="970" border="1" cellpadding="0" cellspacing="0" bgcolor="#C7E8F8" align=center>
      <!--DWLayoutTable-->
      <tr>
        <td height="22"><div align="center">编号 </div></td>
        <td width="117"> <div align="center">姓名</div></td>
        <td> <div align="center">职务</div></td>
        <td> <div align="center">教学班</div></td>
        <td width="117" > <div align="center">民族</div></td>
        <td> <div align="center">政治面貌</div></td>
        <td width="117" > <div align="center">籍贯</div></td>
        <td> <div align="center">入伍时间</div></td>
        <td> <div align="center">文化程度</div></td>
        <td> <div align="center"><font color="#FF0000">量化得分</font></div></td>
      </tr>
      <%
    Do while not rs.eof
    %>
      <TR>
        <td height="22"><div align="center"> <%=rs("id") %></div></td>
        <TD ><div align="center"><%=rs("xingming") %></div></TD>
        <td><div align="center"><%=rs("zhiwu") %></div></td>
        <td><div align="center"><%=rs("banji") %></div></td>
        <td ><div align="center"><%=rs("minzu") %></div></td>
        <td><div align="center"><%=rs("zhengzhimianmao") %></div></td>
        <td ><div align="center"><%=rs("jiguan") %></div></td>
        <td><div align="center"><%=rs("ruwushijian") %></div></td>
        <td><div align="center"><%=rs("wenhuachengdu") %></div></td>
        <td><div align="center"><a href='/swd/lhdf.asp?id=<%=rs("id") %>' target="_blank"><%=rs("lianghuadefeng") %></a></div></td>
      </tr>
      <%
     rs.movenext
    Loop
     %>
    </table><br>
<p align="center">
</p>
    <p align="center">现在是第<%=epage%>页,一共有<%=rs.pagecount%>页 <a href="/swd/index.ASP"><font color="#0099FF">首页</font></a>&nbsp;
      <a href="/swd/index.ASP?page=<%=epage-1%>"><font color="#0099FF">前一页</font></a>&nbsp;
      <a href="/swd/index.ASP?page=<%=epage+1%>"><font color="#0099FF">后一页</font></a>&nbsp;
      <a href="/swd/index.ASP?page=<%=rs.pagecount%>"><font color="#0099FF">末页</font></a>
    <td colspan="2" align="right">&nbsp;
  </form></p>
  <p></p>
</div>

<%
rs.close
conn.close
%>
</font></a>
    <td colspan="2" align="right">&nbsp;
  </form></p>
  <p></p>
</div>

<%
rs.close
conn.close
%>

        <!--用户登陆 -->
<!--页面右边结束-->
<!--页面底部开始-->
</body>
</html>
搜索更多相关主题的帖子: 语句 Microsoft DSNtemp conn 
2008-05-07 14:57
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 
<%
    Do while not rs.eof
    %>      <TR>
        <td height="22"><div align="center"> <%=rs("id") %></div></td>
        <TD ><div align="center"><%=rs("xingming") %></div></TD>
        <td><div align="center"><%=rs("zhiwu") %></div></td>
        <td><div align="center"><%=rs("banji") %></div></td>
        <td ><div align="center"><%=rs("minzu") %></div></td>
        <td><div align="center"><%=rs("zhengzhimianmao") %></div></td>
        <td ><div align="center"><%=rs("jiguan") %></div></td>
        <td><div align="center"><%=rs("ruwushijian") %></div></td>
        <td><div align="center"><%=rs("wenhuachengdu") %></div></td>
        <td><div align="center"><a href='/swd/lhdf.asp?id=<%=rs("id") %>' target="_blank"><%=rs("lianghuadefeng") %></a></div></td>
      </tr>
      <%
     rs.movenext
    Loop
     %>  
这个循环是错误的
下面是个人习惯的分页数据循环方法
     <%
    Dim iPage
    For iPage=1 To rs.PageSize
    %>      <TR>
        <td height="22"><div align="center"> <%=rs("id") %></div></td>
        <TD ><div align="center"><%=rs("xingming") %></div></TD>
        <td><div align="center"><%=rs("zhiwu") %></div></td>
        <td><div align="center"><%=rs("banji") %></div></td>
        <td ><div align="center"><%=rs("minzu") %></div></td>
        <td><div align="center"><%=rs("zhengzhimianmao") %></div></td>
        <td ><div align="center"><%=rs("jiguan") %></div></td>
        <td><div align="center"><%=rs("ruwushijian") %></div></td>
        <td><div align="center"><%=rs("wenhuachengdu") %></div></td>
        <td><div align="center"><a href='/swd/lhdf.asp?id=<%=rs("id") %>' target="_blank"><%=rs("lianghuadefeng") %></a></div></td>
      </tr>
      <%
     rs.movenext
     If rs.EOF Then Exit For
    Next
     %>
2008-05-07 15:18
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
收藏
得分:0 
先谢谢了,我试试看...
2008-05-07 20:40
peiyanjian
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2008-2-29
收藏
得分:0 
KO....谢谢兄弟了......
2008-05-07 20:45
快速回复:少个条件语句要怎么写呀?/
数据加载中...
 
   



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

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