locked
Procedure or function has too many arguments specified RRS feed

  • Question

  • User1215150307 posted

    i checked that all parameters i passed are correct which are changed from not using enterprise library,

    now i use enterprise library, it pop up an error Procedure or function sp_Batch_Update has too many arguments specified. error at if (defaultDB.ExecuteNonQuery(command) == 1)

    Why? How to know which paramter is more?

    DbCommand command = defaultDB.GetStoredProcCommand(stored_procedure_name);
    command = class_name.FillParameters(defaultDB, command);

    public DbCommand FillParameters(Database defaultDB, DbCommand command)
        {
            //defaultDB.AddInParameter(cmdA, "description", DbType.String, newRow53Value);
            defaultDB.AddInParameter(command, "BatchID", DbType.Int32, Batchid);
            defaultDB.AddOutParameter(command, "BatchID", DbType.Int32, 65536);

            defaultDB.AddInParameter(command, "CurrentAccountID", DbType.Int32, Currentaccountid);
            defaultDB.AddInParameter(command, "BatchNo", DbType.String, Batchno);
            defaultDB.AddInParameter(command, "Remarks", DbType.String, Remarks);

            DateTime nullvalue = new DateTime(1755, 1, 1, 0, 0, 0);
            if (Issuedate == nullvalue)
                defaultDB.AddInParameter(command, "IssueDate", DbType.DateTime, System.DBNull.Value);
            else
                defaultDB.AddInParameter(command, "IssueDate", DbType.DateTime, Issuedate.ToString("yyyy/MM/dd HH:mm:ss"));

            if (Chequedate == nullvalue)
                defaultDB.AddInParameter(command, "ChequeDate", DbType.DateTime, System.DBNull.Value);
            else
                defaultDB.AddInParameter(command, "ChequeDate", DbType.DateTime, Chequedate.ToString("yyyy/MM/dd HH:mm:ss"));

            defaultDB.AddInParameter(command, "CompanyCode", DbType.String, Companycode);
            defaultDB.AddInParameter(command, "CompanyName", DbType.String, Companyname);
            defaultDB.AddInParameter(command, "BankCode", DbType.String, account_code);
            defaultDB.AddInParameter(command, "BankName", DbType.String, Bankname);
            defaultDB.AddInParameter(command, "Contact_Person", DbType.String, Contact_person);
            defaultDB.AddInParameter(command, "Urgent", DbType.Int32, Convert.ToInt32(Urgent));
           
            return command;
        }

    Thursday, June 23, 2011 3:16 AM

Answers

  • User1215150307 posted

    solved by commen no account in stored procedure and use addparameter instead of addinparameter

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 23, 2011 4:16 AM

All replies

  • User-843484705 posted

    please check your database stored procedure. How many paramenter Sql storedProcuder has.

    your FillParameters function has 13 parameter. make sure your SQl stored Procudure will have equal number of parameter.

    happy coding

    Thursday, June 23, 2011 3:21 AM
  • User1215150307 posted

    solved by commen no account in stored procedure and use addparameter instead of addinparameter

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 23, 2011 4:16 AM