Crystal 包含子报告的报告 "The report you requested requires further information"

Crystal Report with sub-report "The report you requested requires further information"

我正在 Crystal 2010 年使用 C# 构建一份报告。我的报告必须包含子报告。当我单独 运行 我的报告时它完美地工作,但是当我添加子报告时我立即得到对话框 window 说 "The report you requested requires further information" 我只能输入名称和密码,数据库名称字段是只读。当我输入信息时,它会加载几秒钟,然后再次出现

我的原始报表和子报表使用不同的存储过程,这些存储过程被放入一个数据集中每个报表都连接到它自己的存储过程。当我 运行 仅主报告时 运行 没问题,但是当添加子报告时,diaglog 会重新出现。

我像这样将页面连接到报表,我现在对所有字段进行硬编码,子报表通过 facility_id

链接到主报表
 SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["chartsdbnewConnectionString"].ConnectionString);
    ReportDocument rdoc = new ReportDocument();
    cn.Open();
    SqlCommand cmd = new SqlCommand("RIV_RPT_CENSUS_ASOFDATE_copy_jenny", cn);
    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.AddWithValue("@facility_search_ind", 0);
    cmd.Parameters.AddWithValue("@facility_id_from", 50);
    cmd.Parameters.AddWithValue("@facility_id_to", 50);
    cmd.Parameters.AddWithValue("@facility_name_from", ' ');
    cmd.Parameters.AddWithValue("@facility_name_to", "zz");
    cmd.Parameters.AddWithValue("@Resident_search_ind", 1);
    cmd.Parameters.AddWithValue("@Resident_id_from", 0);
    cmd.Parameters.AddWithValue("@Resident_id_to", 0);
    cmd.Parameters.AddWithValue("@Resident_name_from", "A");
    cmd.Parameters.AddWithValue("@Resident_name_to", "ZZZZ");
    cmd.Parameters.AddWithValue("@AsOfDate", "2016-01-27");
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataTable ds = new DataTable();
    da.Fill(ds);
    rdoc.Load(Server.MapPath("CrystalReport.rpt"));
    rdoc.SetDataSource(ds);
    Session["ReportDocument"] = rdoc;
    crs1.ReportSource = (ReportDocument)Session["ReportDocument"];



    crs1.DataBind();
    cn.Close();

我花了很多时间在谷歌上搜索这个问题,但 none 在线解决方案有效。我觉得我没有以正确的方式连接我的子报告。我对 Crystal 报表技术还很陌生。请帮忙,这是我工作的第三天。

您还需要在代码后面为子报表提供数据源。类似于:

rdoc.OpenSubreport("my_awesome_subreport.rpt").SetDataSource(ds);