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

已解決 我在那裏有兩次相同的隱藏字段導致問題。