Aren't you missing the "Set" statement in there?
ie:
<%
Set cmdEmail = Server.CreateObject("ADODB.Command")
Set rsEmail = Server.CreateObject("ADODB.Recordset")
UPDATE:
In response to Neil's comment of:
Thanks CraigTP. It seems to be
creating the instance of ADODB.Command
and ADODB.Recordset, but having issues
witht he last 4 lines of the code.
I think the last lines of code, should read something like:
cmdEmail.CommandText = "SELECT * FROM VWTenantPropertiesResults WHERE ContentID = ?"
cmdEmail.CommandType = 1
cmdEmail.ActiveConnection = MM_dbconn_STRING
Set adoParam = cmdEmail.CreateParameter("@ContentID", 3, 1, , request.Form("ContentID"))
adoParam.Type = [the datatype of the parameter]
cmdEmail.Parameters.Append(adoParam)
Note that the .CreateParameter
method will return a Parameter
object. You should assign this returned object to a variable which you then use as a parameter to the .Append
method on the Command
object's Parameters
collection.
See these links for more information:
CreateParameter Method (ADO)
Parameters Collection (ADO)
Append Method (ADO)
Note the section headed "Remarks Parameters Collection" where it states:
You must set the Type property of a
Parameter object before appending it
to the Parameters collection.
The .Type
property of the Parameter
object takes a value from the DataTypeEnum enumeration to specify the data type of the parameter. Replace the [the datatype of the parameter]
bit of my code above with the relevant data type enum value.
UPDATE 2:
Sorry, didn't notice the question title text had changed!
Ah.. The old classic "Cannot use parentheses when calling a Sub" error, eh?
Well, this is explained here:
Cannot use parentheses when calling a Sub
In a nutshell:
You invoked a subroutine without the
Call statement, but used parentheses
(). When calling a subroutine without
the Call statement, do not use
parentheses.
To correct this error:
- Remove the parentheses from the subroutine invocation.
- Use the Call statement to invoke the subroutine instead.
There's also a blog post from Eric Lippert that addresses this common error:
What do you mean "cannot use parentheses?"