[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1354
  • Last Modified:

How do I VB.NET pass stored procedure parameters to a report viewer object

I am trying to add myParameterID as a parameter for Me.ReportViewer1.


If I run this code i will see my report load into a web page.


      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

            Dim v_report_name As String = "reportName"
            Dim v_report_server As String = "http://serverName/ReportServer"
            Dim v_report_path As String = "/FolderName/"

                Dim myParameterID As String = "ML2zsidjf99"

            Me.ReportViewer1.ServerReport.ReportServerUrl = New System.Uri(v_report_server)
            Me.ReportViewer1.ServerReport.ReportPath = v_report_path + v_report_name

      End Sub
0
Michael Hood
Asked:
Michael Hood
  • 2
1 Solution
 
Bob LearnedCommented:
Does this answer your question?

Lesson 1: Adding Parameters to Filter Reports by Date (SSRS)
http://technet.microsoft.com/en-us/library/aa337401(v=sql.105).aspx
0
 
Michael HoodAuthor Commented:
No sir,
That link is more for the ssrs sql side of town.

I am working with the code behind for a vb.net page.  I need vb.net code to pass the parameter to a report viewer web object.
0
 
FamousMortimerCommented:
Hi,

You need to add a reference to Microsoft.Reporting.WinForms.

The code below should get you started.

            Dim myReportParams(1) As ReportParameter
            myReportParams(0) = New ReportParameter("myParameterID", "ML2zsidjf99")
            myReportParams(1) = New ReportParameter("anotherParam", "YourValueHere")
            Me.ReportViewer1.ServerReport.SetParameters(myReportParams)

Open in new window

0
 
Michael HoodAuthor Commented:
thanks
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now