我在使用stimulsoft报告处理关系时遇到错误

时间:2017-03-29 06:55:55

标签: c# stimulsoft

错误是:附加信息:父数据源'EmpDetails'和 子数据源'SalaryDetails'不在一个DataSet中 不能用于'EmpSal'!您可以使用属性CacheAllData 报告将此数据源缓存到一个DataSet。

 public class Employeedetails
 {
    public string EmployeeName { get; set; }
    public string JoiningDate { get; set; }
    public string Designation { get; set; }
    public string Department { get; set; }
    public string Nationality { get; set; }
    public string Status { get; set; }
    public string ContractType { get; set; }
    public string LastWorkingDate { get; set; }
    public string LengthofService { get; set; }
    public string ReasonforExit { get; set; }
    public int EmployeeId { get; set; }
}

public class EmployeeSalaryDetails
{
    public int EmployeeId { get; set; }
    public string AllowanceName { get; set; }
    public string Amount { get; set; }
} 

report.CacheAllData = true;                      
report.Load(Server.MapPath("~/Content/Reports/ReportTemplates/FinalSettlementReport - Copy.mrt"));
report.RegData("EmpDetails", EmployeeDetailsList);
report.RegData("SalaryDetails", EmployeeSalaryList);

this is report designin in stimulsoft

2 个答案:

答案 0 :(得分:0)

report.CacheAllData = true;
report.Load(Server.MapPath("〜/ Content / Reports / ReportTemplates / FinalSettlementReport - Copy.mrt"));

//使用此功能。

report.Compile();

report.RegData(" EmpDetails",EmployeeDetailsList); report.RegData(" SalaryDetails",EmployeeSalaryList);

答案 1 :(得分:0)

report.Load(Server.MapPath("~/Content/Reports/ReportTemplates/FinalSettlementReport - Copy.mrt"));
                report.RegData("EmpDetails", EmployeeDetailsList);
                report.RegData("SalaryDetails", EmployeeSalaryList);                
                report.RegBusinessObject("SchoolInfoModel", schoolInfo);
                report.CacheAllData = true;

更改report.CacheAllData = true后的位置;在加载报告完成后,它可以正常工作。 '