Weird - Procedure expects parameter which was not supplied

  • Hello,

    I have a stored procedure which takes ~15 parameters. This sproc is for inserting all the information when a customer places an order online. Like once every month I get this error message - Procedure 'proc_insertorderdetails' expects parameter '@amount', which was not supplied. @amount is one of the 15 parameters. It is weird, if I go into the database and look up the tables, all the information for the particular customer/order has been updated/inserted correctly, including the amount. I am using BEGIN TRAN, COMMIT TRAN, and ROLLBACK TRAN through out the sproc. I have no clue why this error message is being thrown. It is a big pain because we authorize the credit card first, and unless this sproc returns a success, we don't charge the credit card. Any suggestion what might be happening, how can I debug it?

    -----------------------------------------------------------------------------------------------------------------------

    Procedure 'proc_insertorderdetails' expects parameter '@amount', which was not supplied

    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)

    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)

    at ....InsertOrderDetails(...)

    at ....CmdPlaceOrder_Click(Object sender, EventArgs e)

    Thanks

  • I guess it has nothing to do with SQL.

    You need to find why your method CmdPlaceOrder_Click could call procedure without supplying that parameter.

    _____________
    Code for TallyGenerator

  • I don't know your application, but perhaps something was resubmitted or yo u are missing information and don't know it.

    I would check the application and see if there is a way the paremeter could not be sent.

  • I've also seen this error where there's a mismatch in the datatypes.

  • You say that the amount is being updated which implies that it is being passed from the application. Can you confirm that it is this sored procedure that is doing the updating on this call? Is the message actually coming from the main procedure or could it have bubbled up from a sub-procedure, function or trigger?

  • I'd also consider running a Trace and specifying textdata of:

    '%proc_insertorderdetails%' with SPStmtStarting, SPStmtCompleted, RPC:Completed and SQL:BatchCompleted turned on. That way, you will be able to see exactly how the procedure is being called, with what parameters, and if/when it errors, you can copy/paste that line into QA to further troubleshoot.

    Two things to note:

    1. I've had some issues with case sensitivity when using Profiler in this fashion. I'm not sure if that was my imagination, or if the TextData really is case sensitive, but try to put it in exactly as it is being called by your application.

    2. You need sysadmin permissions to run a trace.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply