Click here to Skip to main content
12,629,493 members (35,075 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# VB VB.NET Reporting
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 2-Oct-12 21:39pm
AlmirM666
Comments
Abhijit Parab 3-Oct-12 2:46am
   
Are u showing SSRS report in reportviwer?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161205.3 | Last Updated 3 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100