The Temple of Fu

code, systems and games

Archive for August 2012

Procedure or function X expects parameter Y, which was not supplied.

with 3 comments

I have been tracking down the source of this error for about an hour and a half.

“Procedure or function ‘procedure name’ expects parameter ‘@parameter_name’, which was not supplied.”

This is happening when I call a stored procedure with parameters through .Net’s data connection to SQL (System.data.SqlClient) and also through a WCF client proxy. The only way I was even able to see that error was via SQL Profiler and by executing the code it captured but that’s because we do not have good logging setup on our WCF endpoints yet. After much pain and debugging I found that it was because I forgot to add (or accidentally removed) a critical piece when setting this up, so yes it all comes down to user ID10T error but isn’t it always.

m_cmd.CommandType = CommandType.StoredProcedure

Hope this helps someone, off to refill my coffee cup!

Written by lordfu

August 30, 2012 at 9:52 am