all groups > sql server reporting services > december 2004 >
You're in the

sql server reporting services

group:

C# render method error - invalid arguements


C# render method error - invalid arguements Stephen
12/25/2004 1:34:07 PM
sql server reporting services:
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.
Re: C# render method error - invalid arguements Tim Ellison
12/27/2004 10:14:30 AM
use the ref keyword in place of the out keyword.

[quoted text, click to view]
"<DeviceInfo><HTMLFragment>false</HTMLFragment><Zoom>100</Zoom><Toolbar>FALS
E</Toolbar></DeviceInfo>";
[quoted text, click to view]

Re: C# render method error - invalid arguements Stephen
12/29/2004 8:10:41 AM
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.

[quoted text, click to view]
AddThis Social Bookmark Button