none
Visual Studio 2010 Reporting Services Data retrieval failed for the subreport RRS feed

  • Question

  • After finding several examples of code, I've come up with the following code. However, I am getting "Data retrieval failed for the subreport" error on my .aspx page. The main report and subreport works fine in BIDS 2008, so it has to be something wrong my .cs or .aspx pages.

    Can anyone tell me what I'm doing wrong?

    Thanks!

    Here's the .aspx code:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="SummeryReportOutBrief.aspx.cs" Inherits="Secured_Reports_SummeryReportOutBriefAll" %>
    
    
    <%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
    
    
    <asp:Content ID="Main" ContentPlaceHolderID="ContentPlaceHolderMain" Runat="Server">
    
        <asp:DropDownList ID="DropDownListVisit" runat="server" DataTextField="VisitList"
            DataValueField="VisitID" AutoPostBack="True"  AppendDataBoundItems="true"
            onselectedindexchanged="DropDownListVisit_SelectedIndexChanged"
            DataSourceID="EntityDataSourceVisitDropDown">
            <asp:ListItem Text="--- Select Ship & Visit ---" Value="" Selected="True"></asp:ListItem>
        </asp:DropDownList>
    
        <asp:EntityDataSource ID="EntityDataSourceVisitDropDown" runat="server"
            ConnectionString="name=Admiral_NSSAEntities"
            DefaultContainerName="Admiral_NSSAEntities" EnableFlattening="False"
            EntitySetName="vw_VisitList"
            Select="it.[VisitID], it.[VisitList], it.[ShipName], it.[StartDate]"
            OrderBy="it.[ShipName] asc, it.[StartDate] desc">
        </asp:EntityDataSource>
    
        <rsweb:ReportViewer ID="ReportViewerSummeryReportOutBrief" runat="server" Font-Names="Verdana"
            Font-Size="8pt" InteractiveDeviceInfos="(Collection)"
            WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="1139px"
            Height="894px" PageCountMode="Actual" PromptAreaCollapsed="True"
            style="margin-right: 0px">
            <LocalReport ReportPath="Secured\Reports\SummeryReportOutBrief.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="EntityDataSourceVisitInfo"
                        Name="VisitInfo" />
                    <rsweb:ReportDataSource DataSourceId="EntityDataSourceWorkOrders"
                        Name="WorkOrders" />
                    <rsweb:ReportDataSource DataSourceId="EntityDataSourcePartsDataByWorkOrder"
                        Name="PartsDataByWorkOrder" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
    
        <asp:EntityDataSource ID="EntityDataSourcePartsDataByWorkOrder" runat="server"
            ConnectionString="name=Admiral_NSSAEntities"
            DefaultContainerName="Admiral_NSSAEntities" EnableFlattening="False"
            EntitySetName="vw_PartsDataByWorkOrder" >
        </asp:EntityDataSource>
    
        <asp:EntityDataSource ID="EntityDataSourceWorkOrders" runat="server"
            AutoGenerateOrderByClause="True" AutoGenerateWhereClause="True"
            ConnectionString="name=Admiral_NSSAEntities"
            DefaultContainerName="Admiral_NSSAEntities" EnableFlattening="False"
            EntitySetName="vw_WorkOrders" Where="">
            <WhereParameters>
                <asp:ControlParameter ControlID="DropDownListVisit" DbType="Guid"
                    Name="VisitID" PropertyName="SelectedValue" />
            </WhereParameters>
        </asp:EntityDataSource>
    
        <asp:EntityDataSource ID="EntityDataSourceVisitInfo" runat="server"
            AutoGenerateOrderByClause="True" AutoGenerateWhereClause="True"
            ConnectionString="name=Admiral_NSSAEntities"
            DefaultContainerName="Admiral_NSSAEntities" EnableFlattening="False"
            EntitySetName="vw_VisitInfo" Where="">
            <WhereParameters>
                <asp:ControlParameter ControlID="DropDownListVisit" DbType="Guid"
                    Name="VisitID" PropertyName="SelectedValue" />
            </WhereParameters>
        </asp:EntityDataSource>
    
        </asp:Content>

    In the code behind:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Microsoft.Reporting.WebForms;
    using System.Configuration;
    
    public partial class Secured_Reports_SummeryReportOutBriefAll : System.Web.UI.Page
    {    
        protected void Page_Load(object sender, EventArgs e)
        {               
            if (DropDownListVisit.SelectedValue == "")
            {
                this.ReportViewerSummeryReportOutBrief.Visible = false;
    
                ReportViewerSummeryReportOutBrief.LocalReport.Refresh();             
                ReportViewerSummeryReportOutBrief.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessingEventHandler);               
            }
        }
    
        public void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
        {
            
            e.DataSources.Add(new ReportDataSource("PartsDataByWorkOrder", this.EntityDataSourcePartsDataByWorkOrder));
        }
    
        protected void DropDownListVisit_SelectedIndexChanged(object sender, EventArgs e)
        {
            //In App_Code _TemplateFiles
            Reports.ShowReport(this.DropDownListVisit, this.ReportViewerSummeryReportOutBrief);
        }
    }


    ~Sonny

    • Moved by Mike Feng Wednesday, February 13, 2013 11:17 AM
    Tuesday, February 12, 2013 3:11 AM

All replies