繁体   English   中英

响应重定向错误

[英]Response.Redirect error

我有收集数据的表单页面。 用户单击“提交”,这将转到“发布页面。此页面的末尾是我正在使用的重定向代码response.redirect( "test.asp?ChecklistID=" + ChecklistID )出于某种原因,结果是这样。

/test.asp?ChecklistID=4784,%204784

为什么返回两个ID? 我在“结果”表中只有一个记录。 它是“ 4784”。

添加代码

<%
'Option Explicit
Dim SQLStmt, sql, RS, ChecklistID, Location, ChecklistDate, Driveup, 
ConnectString, conn, objconn
Dim weeds, parking_lot, sidewalk, windows, exterior_trash, door_clean
Dim mats_clean, Notes_page1

Location = Request("Location")
ChecklistDate = Request("ChecklistDate")
Driveup = Request("Driveup")
ChecklistID = Request("ChecklistID")
weeds = Request("weeds")
parking_lot = Request("parking_lot")
sidewalk = Request("sidewalk")
windows = Request("windows")
exterior_trash = Request("exterior_trash")
door_clean = Request("door_clean")
mats_clean = Request("mats_clean")
Notes_page1 = Request("Notes_page1")

ConnectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & 
Server.MapPath("../xyz/mydatabase.mdb")
Set conn = Server.CreateObject("ADODB.Connection")
conn.open ConnectString

SQLStmt = "SELECT * FROM Results WHERE ChecklistID =" & ChecklistID & " ; "

Set RS = Server.CreateObject("ADODB.Recordset") 

RS.open "Results", conn, 3, 3
RS.Update
RS("ChecklistDate") = ChecklistDate
RS("Driveup") = Driveup
RS("weeds") = weeds
RS("parking_lot") = parking_lot
RS("sidewalk") = sidewalk
RS("windows") = windows
RS("exterior_trash") = exterior_trash
RS("door_clean") = door_clean
RS("mats_clean") = mats_clean
RS("Notes_page1") = Notes_page1
RS.Update

RS.close
set RS = nothing
conn.close
set conn = nothing  

response.redirect( "test.asp?ChecklistID=" + ChecklistID )

%>

浏览器可能会保留一些带有response.redirect的历史记录。 尝试使用Server.Transfer。 或者,如果是同一页面,则可能不必重新添加查询字符串。

解决了我在其中存在相同的隐藏字段两次的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM