0

我有收集数据的表单页面。用户点击提交,都到了“后页面,在此页面的到底是重定向代码,我使用。 response.redirect("test.asp?ChecklistID=" + ChecklistID) 出于某种原因,结果是这样的。Response.Redirect错误

/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) 

%> 
+0

向我们展示相关的代码? – IrishChieftain

+0

结果实际上是一个id 2次 - 你看到的是逃脱'ChecklistID = 4784,4784'(请注意逗号后的空格 - 转义后为%20)。你检查变量ChecklistID吗?它是字符串吗?也许somwhere其他代码中你添加了2次? – smartobelix

+0

添加代码 – Jim

回答

0

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

+0

我从来没有遇到使用此response.redirect代码的浏览器保留历史记录的问题。我很茫然。 – Jim

+0

Fwiw:https://msdn.microsoft.com/en-us/library/540y83hx.aspx?f=255&MSPPError=-2147217396 – wazz

0

已解决 我在那里有两次相同的隐藏字段导致问题。