Quantcast
Channel: SQL Server Reporting Services
Viewing all articles
Browse latest Browse all 1418

Hopw to pass parameter to rdlc Report in ASP.Net?

$
0
0

Greetings,

I`m developing an ASP.NET web application using VB code in VS 2013. I have designed rdlc report "Report1" and locate a Report Viewer inside a page "ReportViewer.aspx".

I've created a dataset and created a table "Table1" inside it. Then I configured the Report1datasource to get data from that Table1. The report is running great; however, when I passed a parameter to it, an error is generated at runtime:

"An error occurred during local report processing. The definition of the report 'Main Report' is invalid"

Note the following details:

  • VS 2013 project .Net Framework: 4.5
  • References: Microsoft.ReportViewer.Common & Microsoft.ReportViewer.WebForm runtime version is v2.0.50727

Hereafter is my code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            Dim dt As DataTable
            dt = CType(Session("table"), DataTable)
            'Dim ds As DataSet
            'ds = CType(Session("dataset"), DataSet)
            Dim rptname As String
            rptname = Session("rptname")
            Dim title As String
            title = Session("title")
            Dim color As Integer
            color = Session("color")
            Dim Param() As ReportParameter = {New ReportParameter("paramTitle", title)}          
            If Not IsPostBack Then
                rptViewer.ProcessingMode = ProcessingMode.Local
                rptViewer.LocalReport.ReportPath = Server.MapPath("~/Reports/" & rptname)
                Dim datasource As New ReportDataSource("ds", dt)
                rptViewer.LocalReport.DataSources.Clear()
                rptViewer.LocalReport.DataSources.Add(datasource)
                rptViewer.LocalReport.SetParameters(Param(0))       
                rptViewer.LocalReport.Refresh()
            End If
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
    End Sub

Please advise what I`m doing wrong, and communicate your workaround to resolve this issue.

Thanks,


Viewing all articles
Browse latest Browse all 1418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>