新手求助,asp 查询access 考勤表问题
基本情况:1. 数据库名:kaoqin.mdb , 表:kaoqin_tab 字段:id(自动编号)zb bh name date t1 t2 t3......
2. 由于是考勤数据处id字段是自动编号无重复外,其他均有可能重复
Kaoqin_tab例如:
id zb bh name date t1 t2 tn..
1 高三组 00001 张三 2011-8-5 08:30 11:30 .......
2 高三组 00001 张三 2011-8-6 08:30 11:30 .......
3 高三组 00002 李三 2011-8-5 08:30 11:30 .......
4 高三组 00002 李三 2011-8-6 08:30 11:30 .......
3.现需要按姓名查找并显示,该表中所有该人记录。
4. index.asp 代码为:
<form name="form1" action="search.asp" method="POST">
<p align="center">学生姓名:
<input name="input_name" type="text" size="13">
<input type="submit" value="查询" name="submit"></p>
</form>
5.conn.asp 代码为:
<%
'定义连接及打开连接为各程序共用
dim conn
dim connstr,db
on error resume next
db="\data\kaoqin.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
conn.open connstr
%>
6. search.asp 代码为
<!--#include file="conn.asp"-->
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学生考勤系统查询结果</title>
<%
dim name_id
name_id=request.Form("input_name")
sql="select * from kaoqin_tab where name='"&trim(name_id)&"' "
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
IF rs.eof and rs.bof Then
response.Redirect("err.asp")
else
%>
<%
response.write "<table border=1 align=center>"
response.write "<tr>"
response.write "<td>序号</td>"
response.write "<td>年级组</td>"
response.write "<td>指纹号</td>"
response.write "<td>姓名</td>"
response.write "<td>日期</td>"
response.write "<td>考勤1</td>"
response.write "<td>考勤2</td>"
response.write "<td>考勤3</td>"
response.write "<td>考勤4</td>"
response.write "<td>考勤5</td>"
response.write "<td>考勤6</td>"
response.write "<td>考勤7</td>"
response.write "<td>考勤8</td>"
response.write "</tr>"
do while not rs.eof
response.write "<tr>"
response.write "<td>"&rs("id")&"</td>"
response.write "<td>"&rs("zb")&"</td>"
response.write "<td>"&rs("bh")&"</td>"
response.write "<td>"&rs("name")&"</td>"
response.write "<td>"&rs("date")&"</td>"
response.write "<td>"&rs("t1")&"</td>"
response.write "<td>"&rs("t2")&"</td>"
response.write "<td>"&rs("t3")&"</td>"
response.write "<td>"&rs("t4")&"</td>"
response.write "<td>"&rs("t5")&"</td>"
response.write "<td>"&rs("t6")&"</td>"
response.write "<td>"&rs("t7")&"</td>"
response.write "<td>"&rs("t8")&"</td>"
response.write "</tr>"
rs.movenext
loop
response.write "</table>"
'end if
%>
<%rs.close
set rs=nothing
conn.close
set conn=nothing
%>
8.本机无法安装IIs ,现在用netbox 本地执行
基本情况是这样,由于我是新的不能再新的新手,无能输入什么都返回到 err.asp 请高手修改,谢谢 。