I wrote the following stored procedure :
ALTER PROCEDURE GetOrdersCount
/* Returns the number of orders records at the OrdersMain table */
I called to this stored procedure as follows :
public int GetOrdersCount()
int ordersCount = 0;
command.CommandText = "GetOrdersCount";
command.CommandType = CommandType.StoredProcedure;
// activate the stored procedure to add lines to the database.
ordersCount = (int)command.ExecuteScalar();
The problem that after some calls to that procedure I get an exception that says :
"Procedure GetOrdersCount has no parameters and arguments were supplied".
Please tell me why is that happen and how to fix it.