SSRS & asp.net - passing parameters from .net to ssrs to report viewer

I'm going to start using the report viewer on my .net page. I have a page that will search for a category, when I click the button, the selected category goes into the parameter of the report viewer.

Now, given that I am new to SSRS and .net, I would just take a little advice on how to handle this.

Should I first make a report in SSRS and include the parameters in this report, or can I make a report without the specified parameters, then programmatically enter this in codebehind?

Basically, I know what I would like to do, but I'm not sure what works best.

If anyone can offer advice, I would be very grateful.

+4
source share
1 answer

Welcome to the world of ASP.NET reporting! SSRS has a little learning curve, but as soon as you get it, I'm sure you'll enjoy working with it.

I recommend that you first create a report, including your parameters.

Then you can set the parameter values ​​in the code like this:

Private Sub SetReportParameters(ByVal viewer As ReportViewer) ''# use parameters to pass info to report Dim myStartDate As New ReportParameter("StartDate", Request.QueryString("startDt")) Dim myEndDate As New ReportParameter("EndDate", Request.QueryString("endDt")) Dim myRegion As New ReportParameter("Region", region) Try ''# add parameters to the report viewer.LocalReport.SetParameters( _ New ReportParameter() {myStartDate, myEndDate, myRegion}) Catch ex As Exception ErrorLabel.Text = DATABASE_ERROR_MSG End Try End Sub 
+7
source

Source: https://habr.com/ru/post/1310085/


All Articles