When calling Database.ExecuteDataSet(string storedProcedureName, params object parameterValues) I keep getting an error that the number of parameters does not match the number of parameters in the stored procedure. In fact, the number of parameters do
match. If I create the command object and pass the same three parameters using Database.ExecuteDataSet(DBCommand command) the procedure runs perfectly.
There is a bug in the EnterpriseLibrary that is reporting the wrong error. I have run across this before, as well. The real problem, though, is that the first overload tries to validate the parameter count and throws an exception - even in this case where the
count is correct.
The second overload does not validate the parameter count and, when I purposely leave a parameter out, it passes back the SQLException as it should. This is how all of the overloads should work. Don't disguise the SQLException by trying to wrap it in your own.
All you have done is confused the situation and, in this case, reported an incorrect exception. Now I have no way to identify what was really going on. Class libraries should not generate exceptions unless the exception occurred within the library. This coding-by-exception
example is very bad form.