注册 登录
编程论坛 ASP技术论坛

ASP连接ACCESS数据库,在一个网页如何更改ACCESS内的数据为一固定值

yisen 发布于 2010-10-14 10:02, 1034 次点击
1.asp页面

有ID 姓名 证件领取几项

我想实现在效果是只要在证件领取一栏点击一下,数据库内的未领取自动更新为已领证+点击当时的时间
4 回复
#2
jingjing3162010-10-14 11:27
conn.excute “update 表名 set 列名=’已领证&now()‘”

不知道能不能成功
你试一下看看
#3
yisen2010-10-14 11:59
<%

response.charset="gb2312"
cnStr="provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data.mdb")
set cn = server.createObject("adodb.connection")
set rs = Server.CreateObject("adodb.recordset")
cn.open cnStr
sql = "select * from DATA where 姓名 like '%" &  Trim( request("sid") ) & "%'"
rs.open sql , cn , 3,3
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
<script language="JavaScript">
   document.oncontextmenu=new Function("event.returnValue=false;"); //禁止右键功能,单击右键将无任何反应
   document.onselectstart=new Function("event.returnValue=false;"); //禁止先择,也就是无法复制
</script>
<div style="text-align:center;">
<h1><font color="#0000FF">-> 查询结果 <-</font></h1>
<p><a href="search.asp">按姓名查询页</a></p>
<hr color="#0000FF" noshade>
<table width="829" border="1" bordercolor="#0000FF" height="58">
<tr>
<th style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" height="24" width="44">编号</th>
<th width="123" height="24" bordercolorlight="#0000FF" bordercolordark="#0000FF" style="border-style: solid; border-width: 1px">姓名</th>
<th style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" height="24" width="45">性别</th>
<th style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" height="24" width="52">年龄</th>
<th style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" height="24" width="172">体检日期</th>
<th style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="206">体检结果</th>
<th style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" height="24" width="76">是否领证</th>

</tr>

<%  
 if rs.EOF then response.redirect "error.htm"
 while not rs.EOF
%>
<tr>
<td align="center" style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="44"><%=rs("编号")%></td>
<td align="center" style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF"><%=rs("姓名")%></td>
<td align="center" style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="45"><%=rs("性别")%></td>
<td align="center" style="border-style: solid; border-width: 1px" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="52"><%=rs("年龄")%></td>
<td style="border-style:solid; border-width:1px; " align="center" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="172"><%=rs("体检日期")%></td>
<td style="border-style:solid; border-width:1px; " align="center" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="206"><%=rs("体检结果")%></td>
<td style="border-style:solid; border-width:1px; " align="center" bordercolorlight="#0000FF" bordercolordark="#0000FF" width="76"><%=rs("LZ")%> </tD>
<TD width="59"><a href="mmsave.asp?id=<%=rs("id")%>" target="_self">已取证</a></td>
</tr>

<%
  rs.moveNext
  wend
 rs.close
 cn.close

'ErrH:
'response.redirect "error.htm"
%>
</table>
 
<p><a href="search.asp">按姓名查询页</a></div>
<body>
</html>
#4
yisen2010-10-15 09:22
顶一个
#5
kangli_kl2010-10-15 11:08
二楼的方法应该没问题,思路就是这样的,在你要点击的地方做个链接,链接到一个处理页面去,在这个处理页面里链接数据库将已领的字段填个值然后用字符串连接把当时的时间也填进去就行了
1