错误:尚未为数据源“dataset1”提供数据源实例。

错误:尚未为数据源“dataset1”提供数据源实例。

问题描述:

我试图在我的rdlc报告中显示相同数量的列但数据不同。我的解决方案是创建两个reportviewer,每个都有自己的sqldatasource,我使用存储过程但参数不同。



这是我的代码..



我的ReportViewer1链接的第一个SqlDataSource我创建的Report1.rdlc:

I am trying to display same number of columns but with different data in my rdlc report. My solution is to create two reportviewer and each of them has their own sqldatasource which I used stored procedures but with different parameters.

Here are my codes..

1st SqlDataSource for my ReportViewer1 link to the Report1.rdlc I have created:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
   ConnectionString="<%$ ConnectionStrings:AntiIllegalLoggingConnectionString %>"
   SelectCommand="DamnProc" SelectCommandType="StoredProcedure">
   <SelectParameters>
       <asp:ControlParameter ControlID="txtFrom" Name="dateFrom" PropertyName="Text" Type="String" />
       <asp:ControlParameter ControlID="txtTo" Name="dateTo" PropertyName="Text" Type="String" />
   </SelectParameters>
</asp:SqlDataSource>





我的ReportViewer2的第二个SqlDataSource链接到我创建的Report1.rdlc:



2nd SqlDataSource for my ReportViewer2 link to the Report1.rdlc I have created:

<asp:SqlDataSource ID="SqlDataSource3" runat="server" 

        ConnectionString="<%$ ConnectionStrings:AntiIllegalLoggingConnectionString %>"

         SelectCommand="summaryByRegion"

         SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtParam" Name="strRegion" PropertyName="Text" Type="String" />
            <asp:Parameter DefaultValue="01/01/2014" Name="dateFrom" Type="String" />
            <asp:Parameter DefaultValue="12/30/2099" Name="dateTo" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>





以下是我的报告查看器:



Here are my reportviewers:

<rsweb:ReportViewer ID="ReportViewer1"  runat="server" ZoomMode="Percent" Height="1300px" Width="1050px" ZoomPercent="95">
        <LocalReport ReportPath="Account\ActiveUser\Report1.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet1" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>

    <rsweb:ReportViewer ID="ReportViewer2"  runat="server">
        <LocalReport ReportPath="Account\ActiveUser\Report1.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="SqlDataSource3" Name="DataSet1" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>





我收到了一个错误:(希望你能帮我解决这个问题。谢谢!



I got an error :( Hope you can help me with this. Thank you!

ConnectionStrings:AntiIllegalLoggingConnectionString%>
SelectCommand = DamnProc SelectCommandType = StoredProcedure >
< SelectParameters >
< asp:ControlParameter ControlID = txtFrom 名称 = dateFrom PropertyName = 文字 类型 = 字符串 / >
< asp:ControlParameter ControlID = txtTo 名称 = dateTo PropertyName = 文字 输入 = 字符串 / >
< / SelectParameters >
< / asp:SqlDataSource >
ConnectionStrings:AntiIllegalLoggingConnectionString %>" SelectCommand="DamnProc" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="txtFrom" Name="dateFrom" PropertyName="Text" Type="String" /> <asp:ControlParameter ControlID="txtTo" Name="dateTo" PropertyName="Text" Type="String" /> </SelectParameters> </asp:SqlDataSource>




我的ReportViewer2链接的第二个SqlDataSource我创建的Report1.rdlc:



2nd SqlDataSource for my ReportViewer2 link to the Report1.rdlc I have created:

<asp:SqlDataSource ID="SqlDataSource3" runat="server" 

        ConnectionString="<%


ConnectionStrings: AntiIllegalLoggingConnectionString%>

SelectCommand = summaryByRegion

SelectCommandType = StoredProcedure >
< SelectParameters >
< asp:ControlParameter ControlID = txtParam 名称 = strRegion PropertyName = 文本 类型 = St.响铃 / >
< asp:参数 DefaultValue = 01/01/2014 名称 = dateFrom 类型 = 字符串 / >
< asp:参数 DefaultV alue = 12/30/2099 名称 = dateTo 类型 = 字符串 / >
< / SelectParameters >
< / asp:SqlDataSource >
ConnectionStrings:AntiIllegalLoggingConnectionString %>" SelectCommand="summaryByRegion" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="txtParam" Name="strRegion" PropertyName="Text" Type="String" /> <asp:Parameter DefaultValue="01/01/2014" Name="dateFrom" Type="String" /> <asp:Parameter DefaultValue="12/30/2099" Name="dateTo" Type="String" /> </SelectParameters> </asp:SqlDataSource>





以下是我的报告查看器:



Here are my reportviewers:

<rsweb:ReportViewer ID="ReportViewer1"  runat="server" ZoomMode="Percent" Height="1300px" Width="1050px" ZoomPercent="95">
        <LocalReport ReportPath="Account\ActiveUser\Report1.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet1" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>

    <rsweb:ReportViewer ID="ReportViewer2"  runat="server">
        <LocalReport ReportPath="Account\ActiveUser\Report1.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="SqlDataSource3" Name="DataSet1" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>





我收到错误:(希望你能帮我这个。谢谢!



I got an error :( Hope you can help me with this. Thank you!