locked
Report definition for 'rptReport' hasnot been specified. RRS feed

  • Question

  • User-1842880510 posted

    I am trying to build a report viewer in an ASP.net page.  I am using Reportviewer 11.0.0.0 in a VS 2010 project in VS 2012.

    I did the following:

    1. I copied an RDL file from and SSRS report into the project with the extension changed to rdlc. 
    2. I created a datatable in a dataset file using the SQL used in the original SSRS report.
    3. I opened the report in the report designer and changed the datasource and the dataset to those created in the project in step 2
    4. After several hours, I was finally able to get the report viewer's smarttag to open and  I was able to set the report in the smarttag.  The report has the reference to the dataset saved in it.  So I guess that is why the "Choose Datasource" box showed up empty.  As did the datasource instances. 

    However, the first run of the report gave me an error reporting:

    A data source instance has not been supplied for the data source

    So I tried to do it in the page_load by doing the below.

                this.rvCodCost.ProcessingMode = ProcessingMode.Local;
                this.rvCodCost.LocalReport.ReportPath = "Reports/DodIC_Expiration_Report.rdlc";
                ReportDataSource rds = new ReportDataSource("ReportDataSet", ReportDataSet.DataTable1DataTable);
                this.rvCodCost.LocalReport.DataSources.Add(rds);
    

    However this resulted in the error:

    The call is ambiguous between the following methods or properties: 'Microsoft.Reporting.WebForms.ReportDataSource.ReportDataSource(string, System.Collections.IEnumerable)' and 'Microsoft.Reporting.WebForms.ReportDataSource.ReportDataSource(string, System.Data.DataTable)'

    So I commented out this code and I tried clicking "rebind datasource" several times then running the app.  I now got the error,

    "The report definition for report 'RptXXX' has not been specified."

    It seems like this should be so simple yet I've been working on this one 8 line web page all day and have still not been able to show a report in the report viewer.

    I have view a lot of information on the web but most everyone says to fix this issue, put it in the code which throws the error above.

    I have not seen anyone address the issue of the empty datasource box in the choose datasource or explain why you set the datasource in the report if it is not used.

     

    Friday, August 9, 2013 4:36 PM

Answers

  • User-1842880510 posted
    On this page http://www.gotreportviewer.com/ in the FAQs it says about parameters in reportviewer Q: Why doesn't the ReportViewer control support parameter prompting in local mode? A: The ReportViewer control does not prompt for parameters when in local mode. It prompts for parameters when it is connected to a Report Server. In local mode it does not make sense for ReportViewer to prompt for parameters. The rationale is as follows: The most common use of report parameters is to pass to queries as values of query parameters. But unlike the Report Server, the ReportViewer control does not execute queries itself. Rather, queries are executed by the host application, and the result is passed to the ReportViewer control. So the ReportViewer control does not have the opportunity to set query parameters. Applications should take advantage of the parameterization features of Visual Studio data wizards instead. So I took one of my reports that I had made in SSRS. converted the rdl to an rdlc. I then deleted the part of the RDLC markup file that discussed the query and its parameters by replacing the datasources with one from an rdlc. I then added a dropdown to supply the parameter and built the query using a data adapter in code with the selected value of the dropdown supplying the parameter. I ran that and it opened properly.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 4, 2013 2:22 PM

All replies

  • User-734925760 posted

    Hi,

    Please try to make sure if we connect ok to the ReportDataSoure, so far as I know, I think the ReportDataSet don’t connect ok. We must make sure the dataset is valid. So we can make some breakpoints to debug the application.

    Please try to refer to the following link, it will show us how to connect the DataSource.

    http://stackoverflow.com/questions/4004307/how-can-i-load-datatable-as-reportdatasource

    http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.localreport(v=vs.90).aspx

    Best Regards,

    Michelle Ge

    Monday, August 12, 2013 5:42 AM
  • User-1842880510 posted

    I am not clear on how the information provided is helpful in the particular situation whihc I am experiencing.  Both of those pages refer you on how to dynamically attach a dataset to the report, which I will need to do in the future but I am not to that point as yet.

    I am following the instructions from MSDN given on pages below on how to convert an RDL to an RDLC, and how to update and rebind the datasource.  This discuss on how to use the VS Tools, the controls, and their smarttags to make the needed changes.  Both of which instructions I followed to the letter.

    http://msdn.microsoft.com/en-us/library/ms252109(v=vs.90).aspx

    http://msdn.microsoft.com/en-us/library/ms252085(v=vs.90).aspx

    (I do find it strange that MS in later versions of this page failed to even discuss how to convert an RDL to an RDLC.)

    The dataset file, "ReportDataSet" works fine.   I was able to get a view of the data being pulled by the query. 

    I tried to run the report in the report designer the same way one does in BIDS.   However, I was unable to figure out a way to do that.

    The report's DataSource is set to the dataset file "ReportDataSet"  The dataset properties on the report design page shows the only Dataset in the report being set to "DataTable1" of that Dataset file.  The Foields in the Report's Dataset are the proper fields for the "DataTable1" of the "ReportDataSet".  I see no logical reason this should not be working as specified by Microsoft in their two pages.

     

    Monday, August 12, 2013 10:03 AM
  • User-1842880510 posted

    I removed the "<localReport> tags from the rvCog_Cost control and I uncommented and modified my code in the Page_Load to the below;

    this.rvCodCost.ProcessingMode = ProcessingMode.Local;
    this.rvCodCost.LocalReport.ReportPath = "Reports/DodIC_Expiration_Report.rdlc";
    DataSet dsFile = new DataSet();
    dsFile = new ReportDataSet();
    DataTable dtFile = dsFile.Tables[0];
    ReportDataSource rds = new ReportDataSource(dtFile.TableName,dtFile);
    this.rvCodCost.LocalReport.DataSources.Add(rds);

    The error message return upon building and running in debug is

    A data source instance has not been supplied for the data source 'DataSet1'.

    (Dataset1 is the name of the Dataset of the report)

    Monday, August 12, 2013 11:54 AM
  • User-1225287840 posted

    Could you try changing the below one,

    this.rvCodCost.LocalReport.ReportPath = Server.MapPath("/Reports/DodIC_Expiration_Report.rdlc");

     

    Monday, August 12, 2013 12:03 PM
  • User-1842880510 posted

    Everything I've seen says not to do that.  But in desperation I tried anyway.  Same Error.

    Monday, August 12, 2013 2:02 PM
  • User-1842880510 posted

    Changed the code to look like this;

    this.rvCodCost.ProcessingMode = ProcessingMode.Local;
                this.rvCodCost.LocalReport.ReportEmbeddedResource = "TestWebReport.Reports.DoDIC_Expiration_Report.rdlc";
                DataSet dsFile = new DataSet();
                dsFile = new ReportDataSet();
                DataTable dtFile = dsFile.Tables[0];
                ReportDataSource rds = new ReportDataSource();
                rds.Name = "TestReportDataSet";
                rds.Value = (DataTable)dsFile.Tables[0];
         
                this.rvCodCost.LocalReport.DataSources.Clear();
                this.rvCodCost.LocalReport.DataSources.Add(rds);
                this.rvCodCost.LocalReport.Refresh();

    I got error message in the report viewer as

    A data source instance has not been supplied for the data source 'DataSet1'.

    I then changed the RDS name to "DataSet1" like so:

                rds.Name = "Dataset1";
                rds.Value = (DataTable)dsFile.Tables[0];

    Now the page runs and opens and  there are no error messages on the page.  However there is nothing else on the page either.

    Update:
    The view source of the page reveals a hidden error message
    <h2>
       Report Viewer Configuration Error
      </h2><p>The Report Viewer Web Control HTTP Handler has not been registered in the application&#39;s web.config file.  Add &lt;add verb=&quot;*&quot; path=&quot;Reserved.ReportViewerWebControl.axd&quot; type = &quot;Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91&quot; /&gt; to the system.web/httpHandlers section of the web.config file, or add &lt;add name=&quot;ReportViewerWebControlHandler&quot; preCondition=&quot;integratedMode&quot; verb=&quot;*&quot; path=&quot;Reserved.ReportViewerWebControl.axd&quot; type=&quot;Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91&quot; /&gt; to the system.webServer/handlers section for Internet Information Services 7 or later.</p>

    However, upon review of the web.config, this contention is completely false.  Both references are in there.

    Don't know why this does not show on the page.

    Tuesday, August 13, 2013 4:53 PM
  • User-1842880510 posted

    In less than 20 hours I have to report to our development group on whether the Microsoft Report Viewer can be used to replace a third party control.  Based on my experience so far, I would have to report "No.  It is not possible to get the thing to work properly."

    Wednesday, August 14, 2013 12:35 PM
  • User-1961616419 posted

    I suggest you to read the below mentioned completely tested working example 

    http://www.webcodeexpert.com/2013/07/how-to-create-crystal-reports-in-visual.html

    Thursday, August 15, 2013 2:29 AM
  • User-734925760 posted

    Hi joeller,

    According to the description, if the report is an embedded resource in a separate assembly, then ReportViewer may not be able to find it.

    We can load the resource by ourselves and call the reportViewer.LocalReport.LoadReportDefinition() method to supply the RDL to ReportViewer as a stream.

    We can also load the RDL from the file system by adding a build action to copy the RDL to the same folder as the .exe and then setting the LocalReport.ReportPath to the name of the RDL file.

    As the below code:

    Assembly assembly = Assembly.LoadFrom("Reports.dll");
    
    Stream stream = assembly.GetManifestResourceStream("Reports.MyReport.rdlc");
    
    reportViewer.LocalReport.LoadReportDefinition(stream);
    

    First reset the ReportViewer1 with the following code:

    ReportViewer1.ReSet();

    For more information, please try to refer to the links below:

    http://www.dreamincode.net/forums/topic/120062-using-one-report-viewer-for-many-reports/

    http://forums.asp.net/t/1558176.aspx/1

    Hope it’s useful for you.

    Best Regards,

    Michelle Ge

    Thursday, August 15, 2013 6:36 AM
  • User-1842880510 posted

    1.  We can not use Crystal Reports period.  That is not a permitted application.  In fact, some web apps that years ago used crystal Reports had to be rewritten years ago to remove it and replace it with a markup page displaying what had been the report.  In addition, the reason the cusotmer started using SSRS, three years ago was because of this prohibition.

    2.  @Michelle  The report is not an embedded resource in a separate assembly.   It is a local report.  Using it as an LocalReport.ReportEmbeddedResource or LocalReport.ReportPath works equally successfully. 

    If you had read the thread, you would have seen that the problem with report definition was resolved on 8/12/2013, and was not caused by embedded resource. 

    I've been to both of the links, that you have shown, many times over the last 4 working days since they are referenced from many other pages.  They do not address the issue from which I was suffering then or none.

    The issue is now that the web page cannot recognize the fact that this stupid HTTPhandler is in the web.config. 

    Expert's Exchange suggests that the issue may have to do with the built-in Visual Studio Developmental Web Server (Not IIS) not having these Httphandlers added to it.  I have no idea how one would go about altering that. 

    And why is the error message being shown with display:none?

    Thursday, August 15, 2013 10:01 AM
  • User-1842880510 posted
    <p>The meeting at which I have to report on my findings of using this tool&nbsp;is in 45 minutes and as off now I will have to report that the organization's expert in SSRS could not get the report viewer to work.</p> <p>Update: The decision of the customer is to continue to investigate the usage of the report viewer while investigating building the report in html. So If anyone has anyideas about this invisible httphandler error I would like to hear them. </p>
    Monday, August 19, 2013 2:21 PM
  • User-1842880510 posted
    I submitted an MS support ticket. Working with the report we found that the error had nothing to do with the http handler. It was due to the fact the schema used by the RDLCs that ReportViewer 11.0.0.0 could read were xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" But the schemas used by SSRS RDL xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition" do not comply with the schemas required by RLDC for MS Reportviewer. The MS person stated that there was no possible means by which the XML in the RDL file could be manually modified to meet the requirements of the 2008/01/reportdefinition schema. I find it rather illogical that this should be the case. So I am going to attempt to find out how to modify the schema of the RDL to meet the criteria required by ReportViewer 11.0.0.0.&#65279; -------------------------------------------------------------------------------- Edward R. Joell MCSD MCDBA
    Friday, August 30, 2013 11:03 AM
  • User-1842880510 posted
    It gets stranger. I took the report we created during the trouble call which displayed just fine, and added a dataset and some parameters. Bam!!! HTTPhandler error! I took out the parameters and every thing displayed just fine except that there were no results because no parameter was applied. There is an issue with how the parameters are being read. AND it had nothing to do with the version of the schema!!! I used the 2010/01 schema it it behaved the same way!!! no parameters view is fine but no data. Add parameters HTTPHander error.
    Wednesday, September 4, 2013 9:40 AM
  • User-1842880510 posted
    On this page http://www.gotreportviewer.com/ in the FAQs it says about parameters in reportviewer Q: Why doesn't the ReportViewer control support parameter prompting in local mode? A: The ReportViewer control does not prompt for parameters when in local mode. It prompts for parameters when it is connected to a Report Server. In local mode it does not make sense for ReportViewer to prompt for parameters. The rationale is as follows: The most common use of report parameters is to pass to queries as values of query parameters. But unlike the Report Server, the ReportViewer control does not execute queries itself. Rather, queries are executed by the host application, and the result is passed to the ReportViewer control. So the ReportViewer control does not have the opportunity to set query parameters. Applications should take advantage of the parameterization features of Visual Studio data wizards instead. So I took one of my reports that I had made in SSRS. converted the rdl to an rdlc. I then deleted the part of the RDLC markup file that discussed the query and its parameters by replacing the datasources with one from an rdlc. I then added a dropdown to supply the parameter and built the query using a data adapter in code with the selected value of the dropdown supplying the parameter. I ran that and it opened properly.
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, September 4, 2013 2:22 PM