Databases Reference
In-Depth Information
C#
//create the ReportingService object
ReportingService rs = new ReportingService();
//set the credentials to be passed to Reporting Services
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
VB
'create the ReportingService object
Dim rs As New ReportingService
'set the credentials to be passed to Reporting Services
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Once the ReportingService object has been created and your credentials set, you can go ahead and
render the report. You will create variables to pass any report parameters (none in this example) and
capture the reports encoding, MIME type, parameters used, warnings, and stream IDs. The key output
parameter, which you'll render your report through, is the MIME type. This parameter will tell the
HTTP Response what type of document is being passed back. The following code renders your report to
the web application. You should notice that it is identical to the code used in the Windows application.
C#
ParameterValue[] parameters = new ParameterValue[0];
string encoding;
string mimeType;
ParameterValue[] parametersUsed;
Warning[] warnings;
string[] streamIds;
//render the report
byte[] data;
data = rs.Render(path, format, null, null, parameters, null, null,
out encoding, out mimeType, out parametersUsed,
out warnings, out streamIds);
VB
Dim parameters As ParameterValue()
Dim encoding As String
Dim mimeType As String
Dim parametersUsed As ParameterValue()
Dim warnings As Warning()
Dim streamIds As String()
'render the report
Dim data As Byte()
data = rs.Render(path, format, Nothing, Nothing, parameters, _
Nothing, Nothing, encoding, mimeType, parametersUsed, _
warnings, streamIds)
Search WWH ::




Custom Search