Example for rendering MS SQL 2000 Reporting Service reports in ASP.NET

Sample code to render Reporting Service reports through an ASP.NET application.

Note: This is just a code snippet. You will have to create the proxy class to point to the web service before the code will work. 

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

 ' You must create the web service proxy class to point to
 ' https://rs.discountasp.net/ReportServer/reportservice.asmx
 ' before using this code

        Dim rs As New ReportingService()

        rs.Credentials = New System.Net.NetworkCredential("<report_username>", "<report_password>", "")

        Dim results As Byte(), image As Byte()
        Dim streamids As String(), streamid As String

        ' Render the report to HTML4.0

        results = rs.Render("/<path_to_report>", "HTML4.0", _
        Nothing, "<DeviceInfo><StreamRoot>/WebApplication1/</StreamRoot></DeviceInfo>", Nothing, _
        Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, streamids)

        Response.BinaryWrite(results)

End Sub

Article ID: 228, Created On: 11/14/2008, Modified: 5/25/2010