Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
dont't have much experience with ReportViewer but would appreciate quick guide...
I would like to generate Report in .Net (using both vb and c#) using stored procedure for retrieving data (SQL Server sp). The problem is when I try to pass parameters from my .net code behind to stored procedure. I don't know how to make this working.
Stored procedure accepts 3 parameters as follows:
@Year_s - this should be passed from listbox on windows form
@Consolidation_cd - this shoud be passed from combobox on windows form
@product_id - this should be passed from listbox on windows form

Please, if someone can give me step-by-step guide what should I do in order to make this working.

Thank you for your time and efort

Almir
Posted
Comments
Abhijit Parab 3-Oct-12 2:46am    
Are u showing SSRS report in reportviwer?

1.bind store procedure to your report from dataset of report

2.
Add report parameters in your report with same name which you write in below code ie.
Year_s,Consolidation_cd,product_id

note:

In your report parameter name and passed parameter name must be same.

3.add report viewr to you .aspx page by drag and drop from toolbox
and set reportviewer properties and attributes
ex:
<rsweb:reportviewer runat="server" id="reportviewer1" width="100%" processingmode="Remote" xmlns:rsweb="#unknown">
ShowCredentialPrompts="false" BackColor="AliceBlue" ShowParameterPrompts="false"
ShowBackButton="false" ShowFindControls="false" ShowPrintButton="true"
ShowZoomControl="false" ShowPageNavigationControls="true" ShowRefreshButton="false" Height="400px">


4.code behind

Me.reportviewer1.Visible = True

Me.reportviewer1.ServerReport.ReportServerUrl = New System.Uri("ReportServer url")

While Me.reportviewer1.ServerReport.IsDrillthroughReport
Me.reportviewer1.PerformBack()
End While

Me.reportviewer1.ServerReport.ReportPath = "/ssrsReportprojectname/reportname"

Dim parm(2) As Microsoft.Reporting.WebForms.ReportParameter
parm(0) = New Microsoft.Reporting.WebForms.ReportParameter("Year_s", listbox selected value)
parm(1) = New Microsoft.Reporting.WebForms.ReportParameter("Consolidation_cd", combobox selected value)
parm(2) = New Microsoft.Reporting.WebForms.ReportParameter("product_id", listbox selected value)
Me.reportviewer1.ServerReport.SetParameters(parm)
Me.reportviewer1.ServerReport.Refresh()

i hope it will works
 
Share this answer
 
Reffering to

2.
Add report parameters in your report with same name which you write in below code ie.
Year_s,Consolidation_cd,product_id


where do I do this and how....

Everithing else is clear but not sure how to make this...

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900