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

Posted on 2014-08-15
Last Modified: 2014-08-18
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
Question by:Michael Hood
    LVL 96

    Expert Comment

    by:Bob Learned
    Does this answer your question?

    Lesson 1: Adding Parameters to Filter Reports by Date (SSRS)

    Author Comment

    by:Michael Hood
    No sir,
    That link is more for the ssrs sql side of town.

    I am working with the code behind for a page.  I need code to pass the parameter to a report viewer web object.
    LVL 10

    Accepted Solution


    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")

    Open in new window


    Author Closing Comment

    by:Michael Hood

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now