2015-07-22 79 views
1

我有一個ASP經典頁面,它有一個按鈕,然後打開一個彈出窗口(現在只是一個測試)來執行查詢。但是,這個查詢從不執行(也沒有顯示Response.Write)。爲什麼這不執行?爲什麼這個ASP Classic進程沒有執行?

以下是主頁面的代碼。我仔細檢查並將正確的值傳遞給該函數。

function clearAssignment(assignmentID,docrecid) 
{ 
    window.open("procclearassignment.asp?assignmentID="+assignmentID+"&docrecid="+docrecid,"",'width=375,height=220'); 
} 
<INPUT TYPE="button" class = "sbtn" name="clearassignment" Value="Clear" target="_self" onclick = "clearAssignment(<%=assignmentID%>,<%=docrecid%>);"/> 

下面的過程是:

<!--#include file="content/securityheader.asp"--> 
<!--#include file="connection.inc"--> 
<!--#include file="connectionxref.inc"--> 
<!--#include file="securityheader.asp"--> 
<!--#include file="connectionSQL.inc"--> 

<% 'SQL SECURITY CODE 
    function dbencodeStr(str) 
     thestr = trim(replace(str,"'","&#39;")) 
     thestr = trim(replace(thestr,"""","&#34;")) 
     thestr = trim(replace(thestr,"<","&lt;")) 
     thestr = trim(replace(thestr,">","&gt;")) 
     thestr = trim(replace(thestr,vbCRLF,"<BR>")) 
     dbencodeStr = thestr 
    end function 
%> 
<% 
Server.ScriptTimeout=3600 

'------------------------------ 
Function getName(str) 
index = instr(str," ") 
if index > 0 then 
str = trim(mid(str,1,index)) 
end if 
getName = str 
End Function 
'------------------------------ 

on error resume next 

assignmentID = dbencodeStr(request.Form("assignmentID")) 
docid = dbencodeStr(request.Form("docrecid")) 
thedate = now() 

if docid <> "" Then 
    ''''Close any open assignments for the document 
    strSQL = "update RelDocAssignments set activeflag = 0, closedOn = getdate() where docid = '"&docid&"' and ID = '"&assignmentID&"';" 
    Set rs = objConnection.Execute(strSQL, ,adCmdText) 
end if 
Response.write(strSQL) 

'''''''''''''''''''''''''''''''''''' 
''''''''''''''''''''''''''''''''''' 

objConnection.close 
set objConnection = nothing 
objConnection2.close 
set objConnection2 = nothing 
objConnection3.close 
set objConnection3 = nothing 
%> 

回答

4

您似乎在通過URL /查詢字符串路過你的價值觀:

window.open("procclearassignment.asp?assignmentID="+assignmentID+... 

但你檢索它們,好像他們是發表於:

assignmentID = dbencodeStr(request.Form("assignmentID")) 

我瘦k你想要的:

assignmentID = dbencodeStr(request.QueryString("assignmentID")) 

改爲。