Optional Parameters values of Stored procedures using Applicationb

G

Guest

Hi,

We have written small stored procedure for reading data to dataset. Stored
procedure has total three parameters, in one is mandatory and another two has
default values. If we use SQL Command object or SQL Data Adapter we need not
declare the SQL Parameters for the optional parameters in the stored
procedure(parameters with the default valuse).

Here we are using Microsoft.ApplicationBlocks.Data, when we are passing the
one parameter to the SQLHelper class of method FillDataSet, it is giving error

"Parameter count does not match parameter value count".

Becuse the SqlHelperParameterCache.GetSpParameterSet is returning the three
parameters and it is not returning the optional parameter values.

How to pass parameters to the SQLHelper class when the procedure has
optional parameters. Please help us

Thanks in advance

Regards
Satish
 
W

W.G. Ryan eMVP

There are a few ways to handle it depending on the specific implementation
of SqlHelper you're employing - but the short answer is that if you pass in
Nulls for instance (or Nothing in VB.NET - I mean the literal Null - not
DbNull.Value), then that should get you over the hurdle provided you have
default values specified in the procedure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top