| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 762 人关注过本帖
标题:一个统计数据库记录的程序
只看楼主 加入收藏
兰若云
Rank: 1
等 级:新手上路
帖 子:26
专家分:0
注 册:2004-12-6
收藏
 问题点数:0 回复次数:1 
一个统计数据库记录的程序

哪位大哥帮忙给看下,俺只是添加个统计数字,却怎么搞都是个0,大哥帮俺看下,哪出错了,库中有几条记录,可就是统计不出来,是不是循环时出错了

文件jb-1.asp中

<% dim rs1,sql1,duix,mun duix=rs("Duix") sql1="select * from jobbook where jobname='duix'" set rs1=conn.Execute(sql1) mun=0 do while not rs1.eof mun=mun+1 rs1.movenext loop rs1.close set rs1=nothing %> 是俺添加的统计程序

jb-1.asp

<!--#include file="Inc/syscode.asp"-->

<%'if Request.QueryString("no")="eshop" then 'dim SQL, Rs, contentID,CurrentPage 'CurrentPage = request("Page") 'contentID=request("ID")

'set rs=server.createobject("adodb.recordset") 'sqltext="delete from job where Id="& contentID 'rs.open sqltext,conn,3,3 'set rs=nothing 'conn.close 'response.redirect "Manage_Job.asp" 'end if

%> <% set rs=server.createobject("adodb.recordset") sqltext="select * from job order by id desc" rs.open sqltext,conn,1,1

dim MaPerPage MaPerPage=4

dim text,checkpage text="0123456789" Rs.PageSize=MaPerPage for i=1 to len(request("page")) checkpage=instr(1,text,mid(request("page"),i,1)) if checkpage=0 then exit for end if next

If checkpage<>0 then If NOT IsEmpty(request("page")) Then CurrentPage=Cint(request("page")) If CurrentPage < 1 Then CurrentPage = 1 If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount Else CurrentPage= 1 End If If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if Else CurrentPage=1 End if

call showpages call list

If Rs.recordcount > MaPerPage then call showpages end if

'显示帖子的子程序 Sub list()%>

<TABLE cellSpacing=0 cellPadding=0 width="490" border=0> <TBODY> <TR> <TD width="26" height=1><IMG height=1 src="img/1x1_pix.gif" width=10></TD> <TD background=img/naBialym.gif height=1><IMG height=1 src="img/1x1_pix.gif" width=10></TD> </TR> <% if not rs.eof then i=0 do while not rs.eof dim rs1,sql1,duix,mun duix=rs("Duix") set rs1=server.createobject("adodb.recordset") sql1="select * from jobbook where jobname='duix'" set rs1=conn.Execute(sql1) mun=0 do while not rs1.eof mun=mun+1 rs1.movenext loop rs1.close set rs1=nothing %>

<TR> <TD height=1>&nbsp;</TD> <TD height=1><br> <table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#000000"> <tr> <td width="24%" bgcolor="#F3F3DE"> <div align="center">招聘对象</div></td> <td width="76%" bgcolor="#F8FCF8"><%=duix%></td> </tr> <tr> <td bgcolor="#F3F3DE"> <div align="center">招聘人数</div></td> <td bgcolor="#F8FCF8"><%=rs("Rens")%></td> </tr> <tr> <td bgcolor="#F3F3DE"> <div align="center">工作地点</div></td> <td bgcolor="#F8FCF8"><%=rs("did")%></td> </tr> <tr> <td bgcolor="#F3F3DE"> <div align="center">工资待遇</div></td> <td bgcolor="#F8FCF8"><%=rs("daiy")%></td> </tr> <tr> <td bgcolor="#F3F3DE"> <div align="center">发布时间</div></td> <td bgcolor="#F8FCF8"><%=rs("time")%></td> </tr> <tr> <td bgcolor="#F3F3DE"> <div align="center">有效期限</div></td> <td bgcolor="#F8FCF8"><%=rs("Qix")%></td> </tr> <tr> <td height="22" bgcolor="#F3F3DE"> <div align="center">招聘要求</div></td> <td bgcolor="#F8FCF8"><%=rs("yaoq")%></td> </tr> <tr> <td height="22" bgcolor="#F3F3DE"> <div align="center">应聘人数</div></td> <td bgcolor="#F8FCF8"><%=mun%></td> </tr>

<tr bgcolor="#FFFFFF"> <td height="22" colspan="2"><div align="right"><img src="img/dot2.gif" width="4" height="7">&nbsp;<a href="AcceptJob.asp?job=<%=rs("Duix")%>">应聘此岗位</a> </div></td> </tr> </table></TD> </TR> <% i=i+1 if i >= MaPerpage then exit do rs.movenext loop end if %> <TR> <TD height=15></TD> <TD height=1></TD> </TR> <TR> <TD height=1><IMG height=1 src="img/1x1_pix.gif" width=10></TD> <TD background=img/naBialym.gif height=1><IMG height=1 src="img/1x1_pix.gif" width=10></TD> </TR> <TR> <TD height=1>&nbsp;</TD> <TD height=25 bgcolor="#D8D8D8"> &nbsp; <% Response.write "<strong><font color='#000000'>-> 全部-</font>" Response.write "共</font>" & "<font color=#FF0000>" & Cstr(Rs.RecordCount) & "</font>" & "<font color='#000000'>条招聘信息</font></strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" Response.write "<strong><font color='#000000'>第</font>" & "<font color=#FF0000>" & Cstr(CurrentPage) & "</font>" & "<font color='#000000'>/" & Cstr(rs.pagecount) & "</font></strong>&nbsp;" If currentpage > 1 Then response.write "<strong><a href='Job.asp?&page="+cstr(1)+"'><font color='#000000'>首页</font></a><font color='#ffffff'> </font></strong>" Response.write "<strong><a href='Job.asp?page="+Cstr(currentpage-1)+"'><font color='#000000'>上一页</font></a><font color='#ffffff'> </font></strong>" Else Response.write "<strong><font color='#000000'>上一页 </font></strong>" End if If currentpage < Rs.PageCount Then Response.write "<strong><a href='Job.asp?page="+Cstr(currentPage+1)+"'><font color='#000000'>下一页</font></a><font color='#ffffff'> </font>" Response.write "<a href='Job.asp?page="+Cstr(Rs.PageCount)+"'><font color='#000000'>尾页</font></a></strong>&nbsp;&nbsp;" Else Response.write "" Response.write "<strong><font color='#000000'>下一页</font></strong>&nbsp;&nbsp;" End if 'response.write "</td><td align='right'>" 'response.write "<font color='#000000' >转到:</font><input type='text' name='page' size=4 maxlength=4 class=smallInput value="&Currentpage&">&nbsp;" 'response.write "<input class=buttonface type='submit' value='Go' name='cndok'>&nbsp;&nbsp;" %> <% End sub 'rs.close

%> </TD> </TR> </TBODY> </TABLE> </BODY></HTML>

[此贴子已经被作者于2004-12-09 17:41:01编辑过]

搜索更多相关主题的帖子: 统计数据库 记录 
2004-12-09 17:07
哈马拟
Rank: 1
等 级:新手上路
帖 子:270
专家分:0
注 册:2004-7-15
收藏
得分:0 

dim rs1,sql1,duix,mun duix=rs("Duix") set rs1=server.createobject("adodb.recordset") sql1="select * from jobbook where jobname='duix'" set rs1=conn.Execute(sql1) mun=0 do while not rs1.eof mun=mun+1 rs1.movenext loop rs1.close set rs1=nothing

上面蓝色那行有误:如果duix为字符型变量,应改为如下形式

sql="select * from jobbook where jobname="&duix

如果duix为数值型变量,则应改为如下形式:

sql="select * from jobbook where jobname="&"'"&duix&"'" (注意红色部分为单引号)


2004-12-09 18:49
快速回复:一个统计数据库记录的程序
数据加载中...
 
   



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

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