将参数从主报表传递到rdlc中的子报表

问题描述:

在将参数从报表传递到其中包含的子报表时,我们应该从选项(无,Cookie,控件,QueryString,表单,会话,配置文件,路径数据)中选择定义参数中的数据来配置数据源。



Pls Advise





我选择None并且它给了我错误





子报告'rptchildData'的数据检索失败,位于:C:\SSRS \ VSS20Repor \SubReport.rdlc。请查看日志文件以获取更多信息。



他们在日志文件中没有信息





以下是使用的代码





代码落后



What should we select whicle configuring datasource in define parameters from options(None, Cookie,Control, QueryString, Form,Session, Profile, RouteData) while passing parameter from report to its subreport contained in it.

Pls Advise


I am selecting None and it gives me error


Data retrieval failed for the subreport, 'rptchildData', located at: C:\SSRS\VS2010Repor\SubReport.rdlc. Please check the log files for more information.

Their is no info in log files


Below is the code used


code behind

protected void Page_Load(object sender, EventArgs e)
       {
           if(!Page.IsPostBack)
           {

           this.ReportViewer1.LocalReport.SubreportProcessing +=
           new SubreportProcessingEventHandler(SubreportProcessingEventHandler);



           ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource
                   ("dsSource", SqlDataSource1));

           }

       }

       void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
       {
           e.DataSources.Add(new ReportDataSource("dsVBSubReport", this.SqlDataSource2));
       }







aspx






aspx

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"

            Font-Size="8pt" InteractiveDeviceInfos="(Collection)"

            WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Height="800px"

            Width="1000px">
            <LocalReport ReportPath="MainReport.rdlc" EnableExternalImages="True">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="dsMain" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>







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

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

            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="---select statement---">
            <SelectParameters>
                <asp:Parameter Name="Id" />
            </SelectParameters>
        </asp:SqlDataSource>









这里Id是从主报告传递到子报告的参数



我n主要报告的设计视图我已将参数从主报告传递到子报告。



请帮助





Here Id is parameter passed from main report to subreport

In design view of Main Report i have already passed parameter from main report to sub report.

Please Help

ConnectionStrings:ConnectionString %>

ProviderName = <%
ConnectionStrings:ConnectionString %>" ProviderName="<%


的ConnectionStrings:C onnectionString.ProviderName %> SelectCommand = --- select statement --- >
< SelectParameters >
< asp:参数 名称 = Id / >
< / SelectParameters &gt ;
< / asp:SqlDataSource >
ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="---select statement---"> <SelectParameters> <asp:Parameter Name="Id" /> </SelectParameters> </asp:SqlDataSource>









这里Id是从主报告传递到子报告的参数



在主报告的设计视图中,我已将参数从主报告传递到子报告。



请帮助





Here Id is parameter passed from main report to subreport

In design view of Main Report i have already passed parameter from main report to sub report.

Please Help