CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2009
    Posts
    34

    No overload for method 'name' takes '2' arguments

    I'm getting this error and I'm stumped:

    No overload for method 'ReportTemplateRun' takes '2' arguments

    Any assistence greatly appreciated, here is my code:

    Code:
    // Run a report
                int nCommunityID = 123;
                string nReportName = "Report1";
                string nReportOut = "";
                
                try
                {
                    nReportOut = APISess.WebService.ReportTemplateRun(nCommunityID, nReportName);
                }
                catch (SoapException c)
                {
                    MessageBox.Show(c.Message);
                }
    I'm trying to use a 3rd party API, this bit below was provided by the 3rd party:

    Code:
        public void ReportTemplateRun(AdminAPIReportTemplateID ReportTemplateID, bool IncludeSubCommunities, System.DateTime ReportStartDate, System.DateTime ReportEndDate, int ReportCommunityID, ref string ReportName) {
            object[] results = this.Invoke("ReportTemplateRun", new object[] {
                        ReportTemplateID,
                        IncludeSubCommunities,
                        ReportStartDate,
                        ReportEndDate,
                        ReportCommunityID,
                        ReportName});
            ReportName = ((string)(results[0]));
        }

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: No overload for method 'name' takes '2' arguments

    Well, it seems pretty darn obvious. You have a method which takes *6* arguments and you are calling it with only *2*. Sometimes helps to read the error message

  3. #3
    Join Date
    Nov 2009
    Posts
    34

    Re: No overload for method 'name' takes '2' arguments

    Doh! ok, thanks BigEd781.

    Slightly different issue now though

    How do I enter both values for AdminAPIReportTemplateID? I tried the below and it fails with AdminAPIReportTemplateID is a ‘type’ but is used like a ‘variable’.

    Code:
    sReportOut = APISess.WebService.ReportTemplateRun(AdminAPIReportTemplateID (nCommunityID,"test"), bIncludeSubs, sStartDate, sEndDate, nCommunityID, ref sReportName);
    If I change it to:
    Code:
    sReportOut = APISess.WebService.ReportTemplateRun(nCommunityID, bIncludeSubs, sStartDate, sEndDate, nCommunityID, ref sReportName);
    It also fails with: can’t convert from (int) to AdminAPIReportTemplateID

    Any ideas?

    (confused newbie!)

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: No overload for method 'name' takes '2' arguments

    AdminAPIReportTemplateID is a type, so you will need to get an instance of that type and pass it to the method. Now, do not just copy this code in, it may well be wrong because I do not have the definition of AdminAPIReportTemplateID available, but it would look something like this:

    Code:
    AdminAPIReportTemplateID templateId = new AdminAPIReportTemplateID( );

  5. #5
    Join Date
    Nov 2009
    Posts
    34

    Re: No overload for method 'name' takes '2' arguments

    ok cool, all sorted now. Thanks again. (sorry for slow reply, I've been away).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured