.rdlc Report - Cannot create a data reader for dataset 'DataSet1'

后端 未结 11 1555
刺人心
刺人心 2020-12-10 00:31

I have created a .rdlc-Report under VS 2012 using the report wizard and added data source and dataset. When I try to render the report using the code below I get following e

相关标签:
11条回答
  • 2020-12-10 01:20

    You have to give "DataSet1", otherwise it will not work.

    0 讨论(0)
  • 2020-12-10 01:20
    reportviewer1.LocalReport.DataSources.Add(New ReportDataSource("DataSet1", ObjectDataSource1))
    

    it's better you post your code how you set your datasource to the report.

    0 讨论(0)
  • 2020-12-10 01:21

    Please Check Your DataSet Name Is Correct or not.

     reportDataSource = new ReportDataSource
        {
           Name = "DataSet1",// Check This Line. Are You Sure DataSet Name is Correct?
           Value = ListData 
        };
    
    0 讨论(0)
  • 2020-12-10 01:29

    I solved the problem -- my coding error -- I had omitted 'proper' parameter values from the aspx code for the SqlServerDataSource as follows...

    Notice there is NO DefaultValue for parameter-name="p_CSV_VEHICLES"

    AND (it turned out) that the two parameters (="p_CSV_VGROUPS" and ="p_CSV_VEHICLES") could not pass an empty-string "" as the default value -- empty-string is invalid in the select context for these two parameters.

    After I added the DefaultValue and set the DefaultValue(s) to valid string values for each parameter, the report showed perfectly in the ReportViewer control on my web-page.

    Here is the original (not working) aspx-code.

         <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:FCI_WebMainConnectionString %>" 
            SelectCommand="uspRPT_CostDetailFleet" SelectCommandType="StoredProcedure">
            <SelectParameters>
               <asp:Parameter DefaultValue="5" Name="p_UID_DIVISION" Type="Int32" />
               <asp:Parameter DefaultValue="85" Name="p_UID_CUSTOMER" Type="Int32" />
               <asp:Parameter DefaultValue="FCIFLEETGRP" Name="p_SORT_ORDER" Type="String" />
               <asp:Parameter DefaultValue="" Name="p_CSV_VGROUPS" Type="String" />
               <asp:Parameter Name="p_CSV_VEHICLES" Type="String" />
               <asp:Parameter DbType="Date" DefaultValue="#01/01/2013#" Name="p_dtStart0" />
               <asp:Parameter DbType="Date" DefaultValue="#12/31/2013#" Name="p_dtEnd0" />
            </SelectParameters>
         </asp:SqlDataSource>
    
    0 讨论(0)
  • 2020-12-10 01:29
    1. Make sure that you are running on administrator mode and you have access to the SSRS server.

    2. Verify if you have set the correct dataset name or if you are properly loading and assigning it.

    Please check this sample on MSDN.

    0 讨论(0)
提交回复
热议问题