2015-07-22 200 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")) 

改为。