Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.NET
<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>


2nd SqlDataSource for my ReportViewer2 link to the Report1.rdlc I have created:
ASP.NET
<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:
ASP.NET
<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!
Posted
Comments
njammy 30-Jun-15 6:05am    
Does it work if you try one datasource per report? It could be conflicting when trying to use the same for both.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900