locked
No overload for method 'output' takes 21 arguments" in asp.net project RRS feed

  • Question

  • User-945256609 posted

    Dear all,

    I am try to learn asp.net. While enabling the fields I get No overload for method ' output' takes 21 argument in asp.net project. Is there any limitation in arguments length.

    Just a check. Kindly clarify. the error is in the below link.

    No overload for method 'output' takes 21 arguments"

    thanks

    Sathya

    Saturday, March 23, 2019 1:06 PM

All replies

  • User475983607 posted

    You misunderstand the error.  The error means you are trying to pass 21 arguments to a method that does not have a definition with 21 parameters.

    Example.

    public void MyMethod(int param0, int param1, int param2)
    {
        return;
    }
    MyMethod(0, 1, 2, 3)

    The C# programming guide covers the fundamentals and term definitions.

    https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/passing-parameters

    Saturday, March 23, 2019 1:14 PM
  • User1120430333 posted

    No overload for method 'output' takes 21 arguments"

    You are passing either too many parameters to the method, or you are not passing enough parameters to the method.

    It could also be that you a looking at the wrong signature of the method too that can have multiple signatures implemented by overloads, which you should be able to see when you hover over a method with the mouse pointer when trying to code for the method's usage as Visual Stuido displays the overloads. 

    https://www.geeksforgeeks.org/c-sharp-method-overloading/

    Saturday, March 23, 2019 2:01 PM
  • User-1174608757 posted

    Hi sathyaav

    According to the error code, you  haven't provide enough parameters for your method. Else if you want to set the length of parameter, you could use the size property of parameter s.Here is the code, I hope it could help you.

    static void CreateSqlParameterSize()
    {
        string description = "12 foot scarf - multiple colors, one previous owner";
        SqlParameter parameter = new SqlParameter("Description", SqlDbType.VarChar);
        parameter.Direction = ParameterDirection.InputOutput;
        parameter.Size = description.Length;
        parameter.Value = description;
    }

    Best Regards

    Wei

    Monday, March 25, 2019 2:55 AM