You must Sign In to post a response.
  • Category: Windows

    Procedure or function Insert has too many arguments specified

    I try this code but not working properly (only first value add to database second value is not inserted) . Procedure or function Insert has too many arguments specified ,this is the displayed error


    foreach (DataGridViewRow row in dgItems.Rows)
    for (int i = 0; i < dgItems.Rows.Count; i++)
    DataGridViewCellCollection c = dgItems.Rows[i].Cells;

    //dtl.DOC_TYPE = type;
    info1.DOC_NO = DOC_NO.Text;
    info1.ITEM_CODE = c["cCode"].Value.ToString();
    info1.ITEM_DESC_ENG = c["cName"].Value.ToString();
    info1.UOM = c["cUnit"].Value.ToString();
    info1.PRICE = Convert.ToDecimal(c["cPrice"].Value.ToString());
    info1.QUANTITY = Convert.ToInt32(c["cQty"].Value.ToString());
    info1.ITEM_DISCOUNT = Convert.ToDecimal(c["cDisc"].Value.ToString());
    info1.DISC_TYPE = c["DiscTypes"].Value.ToString();
    info1.DISC_VALUE = c["DiscValues"].Value.ToString();
    info1.SERIALNO = c["SerialNos"].Value.ToString();
    info1.BRANCH = lg.Branch;
  • #767243
    The error message "Procedure or function Insert has too many arguments specified ,this is the displayed error" clearly showing that there is some mismatch in procedure/function parameter count. The parameters you are sending to the procedure is not matching the procedure/function parameter.

    1. First check the count of the parameters passing and compare with actual procedure parameters
    2. Check you are passing correct type of Parameters.

    By Nathan
    Direction is important than speed

  • #767245

    To resolve this we need to see your SP parameter declaration too, as per error "Procedure or function Insert has too many arguments specified ,this is the displayed error" the parameters in procedure and code is miss match the count, so that the reason you got this error, request you to kindly recheck your parameters one more time and move further.

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767250
    The problem is probably in the Insertdtl_Meth method, Check the number of parameters your stored procedure Sp_Sale_Dtl_Insert requires and number of parameters being passed to it.
    Chances are in the first iteration hasTax and hasBatch both are false or at least one is false and the number of parameters being passed matches what is required by the stored procedure.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #767304
    Hi Shafeeq.

    Its clearly showing there is mismatch in the parameters which are sent to the procedure.
    Kindly find out the last added parameters in the procedure and while at the time of declaration assign null to those parameters in the procedure, by doing this even if you wont send that parameters it will assign null to that column.
    You are sending 11 parameters that means receiving also should be 11.

    Sridhar Thota.
    Editor: DNS Forum.

  • Sign In to post your comments