I'm trying to pass some parameters to a SQL stored procedure in my classic ASP. I've seen several posts on this and not sure what I'm doing wrong as I don't seem to see my discrepancy.
set conn = CreateObject("ADODB.Connection")
conn.open ("DSN=SERVER;UID=username;PWD=pwd;Database=MyDatabase")
set cmd = Server.CreateObject("ADODB.Command")
set cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = my_proc
cmd.Parameters.Refresh
cmd.Parameters(1) = "MyParam"
set rs = cmd.execute
I'm getting the error
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
on the line cmd.CommandType = adCmdStoredProc
. I also tried to do it the following way with the same error
set conn = CreateObject("ADODB.Connection")
conn.open ("DSN=SERVER;UID=username;PWD=pwd;Database=MyDatabase")
set cmd = Server.CreateObject("ADODB.Command")
set cmd.ActiveConnection = conn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = my_proc
cmd.Parameters.Refresh
cmd.Parameters.Append cmd.CreateParameter("@MyParam, adVarWChar, adParamInput, 50, "test")
set rs = cmd.execute
adovbc.inc
is a poor substitute for META Type Library references. Added the META Type Library reference is a once only (as it's added to theglobal.asa
in your Classic ASP application), whereasadovbc.inc
has to be included in every page or set in another#include
file to apply it globally. – Originally