I have a Classic ASP page that contains the following code to attempt a parametised query;
<%
Set cmdEmail = Server.CreateObject("ADODB.Command")
Set rsEmail = Server.CreateObject("ADODB.Recordset")
cmdEmail.CommandText = "SELECT * FROM VWTenantPropertiesResults WHERE ContentID = ?"
cmdEmail.CommandType = 1
cmdEmail.ActiveConnection = MM_dbconn_STRING
cmdEmail.Parameters.Append
cmdEmail.CreateParameter("@ContentID", 3, 1, , request.Form("ContentID"))
rsEmail.Open cmdEmail
%>
However, the page is now reporting the following error;
Cannot use parentheses when calling a Sub
/welcome/default2.asp, line 436
cmdEmail.CreateParameter(“@ContentID”, 3, 1, , request.Form(ContentID))
———————————————————————–^
Is this some bug with ASP or do I need to change how I attempt parametised queries?
Thank you.
Did you tried just to remove those parenthesis?
cmdEmail.CreateParameter "@ContentID", 3, 1, , Request.Form("ContentID")As far as I remember, that always happens when you call a function and doesn’t use its return value.
UPDATE: Seems the real problem is the line break: