|
<META c>
<%@ codepage ="936" %>
<!--#include file="session.asp" -->
<!--#include file="dbconn.asp" -->
<link rel="stylesheet" type="text/css" href="style.css"><body bgcolor="#FFFFFF" marginheight=0 marginwidth=0 leftmargin=0>
<script language="javascript">
function job(mylink)
{
window.open(mylink,'','top=150,left=120,width=440,height=500,scrollbars=yes')
}
</script>
<%
'查询到的所有的记录数
dim totalPut
'显示的当前页面数
dim CurrentPage
'共分多少页显示
dim TotalPages
'每页显示多少条记录
dim MaxPerPage
'初始设置为4
MaxPerPage=10
'中间的循环变量
dim i,j
'判断如果没有输入页面数,则显示第1个页面
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
'定义的记录集对象
dim rs
'sql命令
dim sql
set rs=server.createobject("adodb.recordset")
'生成sql命令
typeid=request("typeid")
if typeid="" then
sql="Select * From law order by no desc"
else
sql="select * from law where "
sql=sql&cstr(typeid)&" like '%"&request("txtitle")&"%' "
sql=sql&" order by no desc"
end if
'生成记录集
rs.open sql,conn,1,1
'判断是否有记录
if rs.eof and rs.bof then
response.write "<p align='center'>对不起,没有您要查找的信息</p>"
else
'如果有符合条件的记录,则将符合条件的记录总数值赋给变量totalPut
totalPut=rs.recordcount
'分页判断,如果当前页面数小于1,则更改为1
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
'如果当前页数为1,则调用过程showcontent、函数showpage显示
if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"default.asp"
else
'如果当前页数为其他页,则使用书签bookmark来定位后调用过程showcontent、函数showpage显示
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"default.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"default.asp"
end if
end if
rs.close
end if
set rs=nothing
'定义过程SubContent,显示搜索表单
sub showContent
%>
<center>
<TABLE border=0 cellPadding=3 cellSpacing=0 width="600" style="border-collapse: collapse" bordercolor="#111111">
<TBODY>
<TR bgcolor="#ffffcc">
<TD align=left bgcolor="#FFFFFF">
<form name="search" method="post" action="default.asp">
<p align="center">
<img src="images/search.gif"> 默认以案件编号搜索:
<input type="text" name="txtitle" size="25" style="font-size: 9pt">
<select style="font-size: 9pt" name="typeid">
<option value="no">案件编号</option>
<option value="date">日期</option>
<option value="topic">文档标题</option>
<option value="people">办案人</option>
<option value="note">备注</option>
</select>
<INPUT align=absMiddle border=0 src="images/search1.gif" type=image name="I2">
</form>
<p> </p>
<CENTER>
<TABLE border="1" cellspacing="0" width="574" cellpadding="4" style="border-collapse: collapse" bordercolor="#111111" bordercolorlight="#A6D2FF" bordercolordark="#A6D2FF">
<TR height=25 bgcolor="#cccccc">
<TD width="63" align="center" bgcolor="#CEE8FF"><font color="ff6600"><b>案件编号</b></font></td>
<TD width="62" align="center" bgcolor="#CEE8FF"><strong><font color="ff6600">办案日期</font></strong></td>
<TD width="68" align="center" bgcolor="#CEE8FF"><strong><font color="#FF6600">办案人</font></strong></td>
<TD width="67" align="center" bgcolor="#CEE8FF"><strong><font color="ff6600">备注</font></strong></td>
<TD width="48" align="center" bgcolor="#CEE8FF"><font color="#Ff6600"><b>修改</b></TD>
<TD width="48" align="center" bgcolor="#CEE8FF"><font color="#Ff6600"><b>删除</b></TD>
<TD width="146" align="center" bgcolor="#CEE8FF"><font color="#Ff6600"><b>录入</b></TD>
</TR>
<%do while not rs.eof%>
<TR height="20" bgcolor="#ffffff">
<TD width="63" align="left"><font face="Arial"><b><%=rs("no")%></b></font> </td>
<TD width="62"><a href="javascript:job("SELECT.ASP?no=<%=rs("no")%>")"><font color="#FF6600"><%=rs("date")%></font></a></td>
<TD width="63" align="left"><font face="Arial"><b><%=rs("people")%></b></font> </td>
<TD width="63" align="left"><font face="Arial"><b><%=rs("note")%></b></font> </td>
<TD width="48" align="center"><a href="UPDATE.ASP?no=<%=rs("no")%>"><img src="images/edit.gif" alt="修改信息" width="18" height="18" border="0"></a></TD>
<TD width="48" align="center"><a href="DELETE.ASP?no=<%=rs("no")%>"><img src="images/delete.gif" alt="删除信息" width="18" height="17" border="0"></a></td>
<TD width="146" align="center"><a href="INSERT.ASP"><img src="images/add.gif" alt="录入信息" width="16" height="16" border="0"></a></td>
</TR>
<%i=i+1
IF i>=MaxPerPage then exit do
rs.movenext
loop
%>
</TABLE>
</center>
<%
end sub
'定义函数showPage
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
if CurrentPage<2 then
response.write "<table border=0 width=600 cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=ff6600><b>"&n&"</b></font>页 第<font color=ff6600><b>"&CurrentPage&"</b></font>页 共检索到<font color=ff6600><b>"&totalnumber&"</b></font>条信息</TD>"
response.write "<td align=right>"
response.write "【最前页】【上一页】"
else
response.write "<table border=0 width=600 cellspacing=0 cellpadding=0>"
response.write "<tr height=30>"
response.write "<td align=left>"
response.write "共<font color=ff6600><b>"&n&"</b></font>页 第<font color=ff6600><b>"&CurrentPage&"</b></font>页 共检索到<font color=ff6600><b>"&totalnumber&"</b></font>条信息"
response.write "<td align=right>"
response.write "【<a href="&filename&"?page=1&typeid="&tyeid&"&txtitle="&request("txtitle")&">最前页</a>】"
response.write "【<a href="&filename&"?page="&CurrentPage-1&"&typeid="&typeid&"&txtitle="&request("txtitle")&">上一页</a>】"
end if
if n-currentpage<1 then
response.write "【下一页】【最后页】"
else
response.write "【<a href="&filename&"?page="&(CurrentPage+1)&"&typeid="&typeid&"&txtitle="&request("txtitle")&">"
response.write "下一页</a>】【<a href="&filename&"?page="&n&"&typeid="&typeid&"&txtitle="&request("txtitle")&">最后页</a>】"
end if
response.write "</td>"
response.write "</tr>"
response.write "</table>"
response.write "</form>"
end function
%>
</body>
</html>
是这样的,我用asp+access做了个查询网页,兼有录入/删除/修改的功能
开始用login.asp进行用户名验证
验证通过后跳到defult.asp,就是上面那个代码
defult前面有个session.asp是用来禁止直接访问defualt.asp的
就是不通过验证,直接在ie上访问default,就自动跳转到验证页面login.asp
问题就是改来改去,搞到现在正常登陆到dufault界面老说对不起,没有您要查找的信息
找了很久都不知道哪里出了小问题
ps:数据库名叫law,表名叫file
下面有几个字段:no=案件编号
date=日期
topic=文档标题
people=办案人
note=备注
麻烦高手帮忙看看 |
|