Friday, February 24, 2012

C# render method error - invalid arguements

I have the following c# code for rendering reports. The VB equivilant
works perfect but this example bombs on the render method:
ReportingService rs = new ReportingService();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
DataSourceCredentials[] credentials = null;
byte[] result = null;
string reportPath = "/Capital Request/Request";
string historyID = null;
string format = "PDF";
string devInfo = "<DeviceInfo><HTMLFragment>false</HTMLFragment><Zoom>100</Zoom><Toolbar>FALSE</Toolbar></DeviceInfo>";
string showHideToggle = null;
string encoding;
string mimeType;
Warning[] warnings = null;
ParameterValue[] reportHistoryParameters = null;
string[] streamIDs = null;
SessionHeader sh = new SessionHeader();
rs.SessionHeaderValue = sh;
try
{
result = rs.Render(reportPath, format, historyID,
devInfo, parameters, credentials,
showHideToggle, out encoding, out mimeType,
out reportHistoryParameters, out warnings,
out streamIDs);
sh.SessionId = rs.SessionHeaderValue.SessionId;
}
The error is as follows:
CS1502: The best overloaded method match for
'RSProxy.ReportingService.Render(string, string, string, string,
RSProxy.ParameterValue[], RSProxy.DataSourceCredentials[], string, ref
string, ref string, ref RSProxy.ParameterValue[], ref
RSProxy.Warning[], ref string[])' has some invalid arguments
I have tried everything. Any help is appreciated.use the ref keyword in place of the out keyword.
"Stephen" <switter@.enpathmed.com> wrote in message
news:1104010447.834507.213950@.c13g2000cwb.googlegroups.com...
> I have the following c# code for rendering reports. The VB equivilant
> works perfect but this example bombs on the render method:
> ReportingService rs = new ReportingService();
> rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> DataSourceCredentials[] credentials = null;
> byte[] result = null;
> string reportPath = "/Capital Request/Request";
> string historyID = null;
> string format = "PDF";
> string devInfo =>
"<DeviceInfo><HTMLFragment>false</HTMLFragment><Zoom>100</Zoom><Toolbar>FALS
E</Toolbar></DeviceInfo>";
> string showHideToggle = null;
> string encoding;
> string mimeType;
> Warning[] warnings = null;
> ParameterValue[] reportHistoryParameters = null;
> string[] streamIDs = null;
> SessionHeader sh = new SessionHeader();
> rs.SessionHeaderValue = sh;
> try
> {
> result = rs.Render(reportPath, format, historyID,
> devInfo, parameters, credentials,
> showHideToggle, out encoding, out mimeType,
> out reportHistoryParameters, out warnings,
> out streamIDs);
> sh.SessionId = rs.SessionHeaderValue.SessionId;
> }
> The error is as follows:
> CS1502: The best overloaded method match for
> 'RSProxy.ReportingService.Render(string, string, string, string,
> RSProxy.ParameterValue[], RSProxy.DataSourceCredentials[], string, ref
> string, ref string, ref RSProxy.ParameterValue[], ref
> RSProxy.Warning[], ref string[])' has some invalid arguments
> I have tried everything. Any help is appreciated.
>|||That was it! At least in part. The only other thing is the encoding
and mimetype variables were not set:
string showHideToggle = null;
string encoding;
string mimeType;
I got an unassigned variable error so I did the following:
string showHideToggle = null;
string encoding=null;
string mimeType=null;
and it worked. This example came straight out of BOL. Seems there is
a problem with the example. Thats for correcting that for me. I
really appreciate it as I have been working on this for about two
weeks.
Tim Ellison wrote:
> use the ref keyword in place of the out keyword.
> "Stephen" <switter@.enpathmed.com> wrote in message
> news:1104010447.834507.213950@.c13g2000cwb.googlegroups.com...
> > I have the following c# code for rendering reports. The VB
equivilant
> > works perfect but this example bombs on the render method:
> >
> > ReportingService rs = new ReportingService();
> > rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
> > DataSourceCredentials[] credentials = null;
> >
> > byte[] result = null;
> > string reportPath = "/Capital Request/Request";
> > string historyID = null;
> > string format = "PDF";
> > string devInfo => >
>
"<DeviceInfo><HTMLFragment>false</HTMLFragment><Zoom>100</Zoom><Toolbar>FALS
> E</Toolbar></DeviceInfo>";
> > string showHideToggle = null;
> > string encoding;
> > string mimeType;
> > Warning[] warnings = null;
> > ParameterValue[] reportHistoryParameters = null;
> > string[] streamIDs = null;
> > SessionHeader sh = new SessionHeader();
> > rs.SessionHeaderValue = sh;
> >
> > try
> > {
> > result = rs.Render(reportPath, format, historyID,
> > devInfo, parameters, credentials,
> > showHideToggle, out encoding, out mimeType,
> > out reportHistoryParameters, out warnings,
> > out streamIDs);
> > sh.SessionId = rs.SessionHeaderValue.SessionId;
> > }
> >
> > The error is as follows:
> >
> > CS1502: The best overloaded method match for
> > 'RSProxy.ReportingService.Render(string, string, string, string,
> > RSProxy.ParameterValue[], RSProxy.DataSourceCredentials[], string,
ref
> > string, ref string, ref RSProxy.ParameterValue[], ref
> > RSProxy.Warning[], ref string[])' has some invalid arguments
> > I have tried everything. Any help is appreciated.
> >

No comments:

Post a Comment