-
December 1st, 2009, 05:04 PM
#1
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]));
}
-
December 1st, 2009, 05:11 PM
#2
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
-
December 1st, 2009, 06:16 PM
#3
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!)
-
December 1st, 2009, 06:24 PM
#4
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( );
-
December 6th, 2009, 01:49 PM
#5
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|