Yes and no.
While a SP can be defined with default values for none, some or all
parameters, writing the code to execute the SP with a selected set of
parameters is a little tricky. When calling a SP you only have to pass the
parameters that have been defined without default values. In ADO, you can't
simply define a parameter as "missing". If you add it to the Parameters
collection, you have to provide a value. Passing NULL as a value is still
passing a value and the default is over-ridden. To execute an SP with
selected parameters, you have to rebuild the Parameters collection--choosing
just those parameters to add to the collection that you want to include each
time the SP is called. I think it would be interesting to have a "Disabled"
property on the Parameter so you could define it but decide whether or not
it's passed to the server at runtime.
I'll be discussing (and illustrating) this technique at my workshop in
Toronto on June 18th (DevTeach)
hth
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________