I am trying to call a stored procedure from delphi7. The procedure also contains parameters with default values. As far as I understand I can call this procedure without explicitly passing values for parameters, having defaults. That's what I did in my delpho code.
But..
The result of appeared to be confusing. The parameter I skipped did get some value. That was the value for the next parameter. And it appeared the last parameter that didn't get its value instead in the end.
I tried to search and found this article. So, it turns out to be, that delphi ignored the names I gave to the parameteres of the TADOStoredProc and just passed them in the order I added them to the parameters' collection, i.e. the last parameter (happily it was also optional and no exception was thrown) wasn't passed to the procedure.
I see the answer by @crefird, suggesting to use TADOQuery instead of TADOStoredProc. But I don't like the approach. I'd better give certain values to all the parameters and don't use the optional parameters feature at all.
So, is there a better solution to make delphi specify parameters to a stored procedure by their names, when using TADOStoredProc?