Click to See Complete Forum and Search --> : Passing a Null to a stored procudure


MH1975
07-27-2005, 12:41 PM
I'm trying to use an ADO Command object to execute a stored procedure. I have created a function that works somewhat like the following.


function ExecProcFoo (objConnection, ParamVal1, ParamVal2, ParamVal3)
set objCommand = Server.CreateObject("ADODB.Command")
if not (objCommand Is Nothing) then
objCommand.ActiveConnection = objConnection
objCommand.CommandText = "{call ProcFoo(?,?,?)}"
objCommand.Parameters.Append objCommand.CreateParameter("Param1", adInteger, adParamInput, 4, ParamVal1)
objCommand.Parameters.Append objCommand.CreateParameter("Param2", adInteger, adParamInput, 4, ParamVal2)
objCommand.Parameters.Append objCommand.CreateParameter("Param3", adInteger, adParamInput, 4, ParamVal3)
objCommand.Execute()
set objCommand = nothing
end if
end function


The input parameters are usually long integers, but can be null as well. (ProcFoo Val1, null, null for example)

When I try to pass in a null, it is causing an error.

Anyone know how to pass in a Null Parameter?