我决定改写我的问题以使其更容易一些。我有一个包含三个字段的表单
<form class="contact_form" action="divProgramProcess.asp" method="post" name="contact_form">
Couch: <input type="text" name="Couch_Current" id="Couch_Current" />
<br/>
Available:
<input type="text" name="Available_Current" id="Available_Current" />
<br/>
Shipment:
<input type="text" name="Shipment_Current" id="Shipment_Current" />
<input type="submit" value="submit" ></form>
表单调用如下代码divProgramProcess.asp(如下图)
<%
divrec = request.QueryString("div")
Set rstest = Server.CreateObject("ADODB.Recordset")
rstest.locktype = adLockOptimistic sql = "SELECT top 1 * FROM CensusFacility_Records WHERE division_program = 'Division 1' and jmsday ='Sun' order by JMSUpdateDateTime desc "
rstest.Open sql, db
%>
<%
Shipment_Current = request.form("Shipment_Current")
Couch_Current = request.form("Couch_Current")
Available_Current = request.form("Available_Current")
rstest.fields("Shipment") = Shipment_Current
rstest.fields("Couch") = Couch_Current
rstest.fields("Available") = Available_Current
rstest.update
Response.Redirect("chooseScreen.asp")
%>
现在请记住,“JMSUpdateDateTime”列是一个日期字段,并且在 division_program 列名称下有多个“Division 1”记录。我正在尝试更新 SQL 表中的最后一行,但每次运行此脚本时,我只用“Division 1”更新第一条记录,而不是最后一条记录。简单来说:有 10 条记录包含 Division 1。它们都有日期时间戳列。如何更新最后一条记录?