我有收集數據的表單頁面。用戶點擊提交,都到了「後頁面,在此頁面的到底是重定向代碼,我使用。 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)
%>
向我們展示相關的代碼? – IrishChieftain
結果實際上是一個id 2次 - 你看到的是逃脫'ChecklistID = 4784,4784'(請注意逗號後的空格 - 轉義後爲%20)。你檢查變量ChecklistID嗎?它是字符串嗎?也許somwhere其他代碼中你添加了2次? – smartobelix
添加代碼 – Jim