SqlParameterHelper - parameters count doesn't match DB definition

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
5/10/2011 6:30:21 AM
Gravatar
Total Posts 7

SqlParameterHelper - parameters count doesn't match DB definition

hi,

I have a stored procedure with 4 parameters, but I may only want to send it 1 parameters, the others will be set to NULL in the stored procedure so will be ignored by the Query like this:

WHERE

(js.SectorID = @sectorid Or @sectorid is null)....

But if I only give 1 parameter the SqlParameterHelper gives me this error:

parameters count doesn't match DB definition.

How do I get around this, the SP will run correctly.

Many thanks

Richard

 

5/10/2011 8:51:37 AM
Gravatar
Total Posts 18439

Re: SqlParameterHelper - parameters count doesn't match DB definition

Hi Richard,

I would always pass in all the parameters, you can set the parameter value to DBNull.Value if you want to pass in null, but should always pass all the expected parameters.

Also I believe these exceptions are from Debug.Assert which means the error is only thrown when using a debug build, it is designed to alert the developer to incorrect code, a release build would not throw the exception.

Hope that helps,

Joe

You must sign in to post in the forums. This thread is closed to new posts.