中医一附属预约挂号:asp数据更新

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 00:44:00
下面是我编写的一个asp网页,我在当中有二个按扭,分别是修改数据库DB1中的一个内容,我想点击其中的一个按钮后,写入的数据会马上更新,并显示出来,我试了一下,好象一个页面中只能有一个rs.date,我想问要求能否实现。
<html>
<%
dbpath=server.mappath("db1.mdb")
set conn=server.createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source=" & dbpath
%>
<%
exec="select * from admin"
set rs2=server.createobject("adodb.recordset")
rs2.open exec,conn,1,3
exec="select * from "+rs2("list")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>常德网络信息学校千分制考核</title>

</head>
<body>

<div align="center" class="style1"> <span class="style2">常德网络信息学校千分制考核</span>
<hr width="800">

</div>
<form name="form1" width=780 method="post" target="_blank"action="input.asp">
<table width=780 border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
<tr >
<td height="15" colspan="10"> <img src="open.gif" width="20" height="20"><a href="index.asp" class="style2">7班</a>
<input name="Submit3" type="button" onClick="<%rs2("list")="c007u"
%>
" value="7班">
<input name="Submit32" type="button" onClick="<%rs2("list")="c009u"

%>" value="9班">

<input name=refresh type=button onclick=window.location.reload()
value=刷新>
    日期:<%=date()%></td>
</tr>
<tr bgcolor="#339933" >
</tr>
<%do while not rs.eof %>
<tr>
<td width=27 height="18"><input name="s" type="checkbox" value=""></td>
<td width=36 height="18"><%=rs("id")%></td>
<td height="18" ><%=rs("name")%></td>
<td width=25 height="18"><%=rs("sex")%></td>
<td height="18"><%=rs("birth")%></td>
<td height="18" align="center"><div align="center"><%=rs("father")%></div></td>
<td height="18"><%=rs("address")%></td>
<td width=36 height="18"><%=rs("qfz")%> </td>
<td width=30 height="18" align="center"> <input name="text" type="text" onClick="focus();select();" value="0" size="4" maxlength="4"></td>
<td height="18"><%=rs("temp")%> </td>
</tr>

<%
rs.movenext
loop
%>
<tr>
<td height="20" colspan="10"><div align="right">
<input type="submit" name="Submit" value="提交"onClick="javascript:location.reload()">
<input type="reset" name="Submit2" value="重置">
<input type="hidden" name="cla1" value=" c007u">
<input type="hidden" name="cla2" value="c007q">
</div></td>
</tr>
</table>
<%rs2.update%>
<div align="right"></div>
</form>
<hr width="800">
</body>
</html>

你的这段程序有问题欧:
<%
exec="select * from admin"
set rs2=server.createobject("adodb.recordset")
rs2.open exec,conn,1,3
exec="select * from "+rs2("list")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
从admin表中取出表名,再从表中提取数据,位置不对,因该这样写:
<%
exec="select * from admin"
set rs2=server.createobject("adodb.recordset")
rs2.open exec,conn,1,3
While Not rs2.Eof
exec="select * from "+rs2("list")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
While Not rs.Eof
输出相应的内容
Wend
rs.Close
set rs=nothing
Wend
rs2.Close
set rs2=nothing
%>
如果还有问题,可以和我联系,或者发信给我
tjoy7d@126.com