Calling SSRS report from ASP.Net

  • I have a web page in Web Forms with a Script Manager, a Button and a Reportviewer.

    I want to click the button and run my report. The report is not populating. My code is as follows:

     Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click




    Try
    ReportViewer1.ProcessingMode = ProcessingMode.Local

    Dim myreportviewer As ServerReport
    myreportviewer = ReportViewer1.ServerReport

    ReportViewer1.ServerReport.ReportServerUrl = New Uri("https://localhost/ReportServer")
    ReportViewer1.ServerReport.ReportPath = "C:/Practice/Practice/Practice/Report2.rdl"
    ReportViewer1.Height = 900
    ReportViewer1.Width = 900
    ReportViewer1.ServerReport.Refresh()

    Dim Lastname As New ReportParameter()

    Lastname.Name = "Lastname"

    Lastname.Values.Add("Campbelli")
    Dim parameters() As ReportParameter = {Lastname}


    ReportViewer1.ServerReport.Refresh()


    Catch ex As Exception



    Response.Write(ex.ToString())

    End Try

    End Sub
  • This is incorrect:

    ReportViewer1.ServerReport.ReportPath = "C:/Practice/Practice/Practice/Report2.rdl"

    It needs to be the https://localhost/ReportServer/FolderName/ReportName

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply