locked
Create a rdlc report with parameter passed from query string not working, please help, thanks. RRS feed

  • Question

  • User-10248131 posted

    This is my first ever rdlc report so the approach might be totally wrong. Here is what I need and what I have done:

    1. I need to create a page with ReportViewer

    2. The rdlc report is designed using Report Wizard and using stored procedure that has a parameter ID to pass in

    3. The report itself doesn't have the ID field in it

    I put the report in a ReportViewer in a page, the page generate an error saying:

    An attempt was made to set a report parameter 'ID' that is not defined in this report

    My backend code is very simple:

        Sub LoadReport(ByVal ID As Integer)
            Dim param As ReportParameter
    
            param = New ReportParameter("ID", ID.ToString, False)
    
            ReportViewer1.LocalReport.SetParameters(New ReportParameter() {param})
    
            ReportViewer1.ServerReport.Refresh()
    
        End Sub

    It would be greatly appreciated if someone can tell me how to fix it. Thanks in advance.

    Thursday, January 23, 2014 9:16 AM

All replies

  • User-1312722619 posted

    Hello,

    Before deploying your report to report server, you should make sure that it is working properly on Report Designer. As you are saying that there is "ID" parameter on your storedProcedure which is feeding your report, you should provide this parameter on your Report.

    Go to your Report Designer and run the report as it is. You will notice that you will get same error you are getting on Report Viewer on your web page.

    Basically when you create your report by wizard from a StoredProcedure, Report Designed will create parameter "ID" for you automatically. This is beauty of Report Designer. However if it is not there, you should create manually.

    Open your report on designer and go to "Report Data" window. You must see "Built-in Fields", "Parameters", "Images", "DataSources" and "Datasets" sections there. Open the "parameter" section and check for parameter "ID". I guess it is not here. So right click on "Parameters section" and "Add Parameter"

    The rest part is straighforward. Run your report again on Report Designer (before deploying to Report Server" and make sure it is asking for "ID" parameter. if it works properly then deploy to Report Server.

    Hope it will helps.

    Friday, January 24, 2014 6:50 AM
  • User-10248131 posted

    Thank you mezzanine74 for your reply.

    Maybe I was not clear in the OP, let me explain it again here:

    My environment: Visual Studio.NET 2008 + SQL 2005

    1. I have an existing website and I need to create report for that website

    2. I open the website in VS2008, create a new folder called Reports (all my reports will be created under here)

    3. I create a new rdlc report Report.rdlc using the Report Wizard (Right click on the Report folder and click Add New Item and choose Report Wizard)

    4. Select Data Connection, Click next

    5. Choose the stored proceudure spGetFullServerInfoForReportingByID and give it a name GSHDataSet as the Data Set name and click on Finish

    6. Give it a name Report to finish

    Question 1: There is no way to preview the report

    7. Create a new page and put a MicrosoftReportViewer control in it and choose the newly created Report as the report

    Build the project, successful!

    Run it:

    Error:

    <form id="form1" method="post" name="form1" action="TestReport.aspx"> <div style="width: 400px; display: inline-block; height: 400px;" id="ReportViewer1">

    • An error has occurred during report processing.
      • A data source instance has not been supplied for the data source "GSHDataSet_spGetFullServerInfoForReportingByID".

    Question 2: What's wrong with this? What am I missing here? Where to preview the report?

    Thank you very much

    </div> </form>

    Friday, January 24, 2014 3:39 PM
  • User-1312722619 posted

    Hello mdivk,

    I am afraid you didnt install reporting service on your machine.

    I dont see any option under Visual Web Developer for the reports which you created as mentioned below. Reporting Service is coming with Sql Server (including express edition), where you can see under Sql Server Data Tools.

    This is wonderful link which explains installation of Sql Server with Reporting service step by step with pictures.

    Once you manage to install, then we can continue to run your first report.

    Monday, January 27, 2014 6:47 AM
  • User-10248131 posted

    Thanks mezzanine74,

    I don't see link in your reply, did you miss it?

    Tuesday, January 28, 2014 9:03 AM
  • Tuesday, January 28, 2014 9:52 AM
  • User-10248131 posted

    Hello mdivk,

    I am afraid you didnt install reporting service on your machine.

    I dont see any option under Visual Web Developer for the reports which you created as mentioned below. Reporting Service is coming with Sql Server (including express edition), where you can see under Sql Server Data Tools.

    This is wonderful link which explains installation of Sql Server with Reporting service step by step with pictures.

    Once you manage to install, then we can continue to run your first report.

    That's interesting to know but I tried the following things:

    1. double checked and confirmed BID is installed

    2. I tried to install SQL2005 again and the Reporting Service is grayed out, meaning it is already installed

    Any other suggestion?

    Thanks lots.

    Tuesday, January 28, 2014 9:53 AM
  • User-10248131 posted

    Whoop, my post overlapped with yours, I will check out the link now. Thanks.

    Tuesday, January 28, 2014 9:54 AM
  • User-10248131 posted

    I think I need to apply for a new license of SQL 2008R2 and install the reporting service module, however, this should be doable in SQL 2005, right? any suggestion? Thanks.

    Tuesday, January 28, 2014 10:02 AM