Is it possible to build a VBscript parametrized query without knowing the names, types or number of arguments beforehand?
I'm trying to do this:
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = cn
cmd.commandText = proc
cmd.commandType = 4
cmd.Parameters.Refresh
For i = 0 To UBound(params)
cmd.Parameters(i).Value = params(i)
Next
set rs = cmd.Execute
This gives me the error:
ADODB.Parameter error '800a0d5d' Application uses a value of the wrong type for the current operation
The argument string I'm trying to parse is of the form ,'arg1','arg2' etc. Params contains an array of just the args. The stored proc could be one of several types, with different argument types and names. I need to be able to parametrize the query to make sure that the input is sanitized. Any ideas?