You'll have to create the parameters and append them to the command's parameter collection. Just assigning the values to (the same!) parameter can't possibly work. Google for a sample; perhaps this VB! sample will get you started.
Added:
I can think of two strategies to derive the parameter types:
- If you pass the correct/maximally specified parameter values to the function you can map
VarType(value)
constants to parameter type constants - If you do a SELECT based on the fieldnames in the command text, you can map the recordset's field
.Type
s to parameter type constants
It won't be trivial to get this right for all possible cases. I would pass pairs of value and desired type to the function.