CrystalReportViewer中未显示数据 [英] Data is not showing in CrystalReportViewer

查看:48
本文介绍了CrystalReportViewer中未显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



我创建了.xsd文件,数据显示在预览中。我获取了.rpt文件中的所有字段并传递了两个参数。当我运行我的下面的代码Reportviewer时只显示参数值。我怎样才能获得数据?



请帮助我这个无奈!



ReportDocument reportCaseByAgency = new ReportDocument ();

reportCaseByAgency.Load(Server.MapPath(@〜/ Reports / RPT_CaseByAgency.rpt));

reportCaseByAgency.FileName = Server.MapPath(@ 〜/ Reports / RPT_CaseByAgency.rpt);

reportCaseByAgency.SetParameterValue(@ QTR,num2);

reportCaseByAgency.SetParameterValue(@ Year,year);

ReportViewer1.ReportSource = reportCaseByAgency;

//reportCaseByAgency.ReadRecords();

//ReportViewer1.RefreshReport();

//ReportViewer1.DataBind();



谢谢,

Shafik

Hi Experts,

I have created .xsd file and data is showing in the preview.I took all the fields in .rpt file and passing two parameters. When I run my below code Reportviewer showing only Parameter values. How can I get data?

Please help me to this helpless!

ReportDocument reportCaseByAgency = new ReportDocument();
reportCaseByAgency.Load(Server.MapPath(@"~/Reports/RPT_CaseByAgency.rpt"));
reportCaseByAgency.FileName = Server.MapPath(@"~/Reports/RPT_CaseByAgency.rpt");
reportCaseByAgency.SetParameterValue("@QTR", num2);
reportCaseByAgency.SetParameterValue("@Year", year);
ReportViewer1.ReportSource = reportCaseByAgency;
//reportCaseByAgency.ReadRecords();
//ReportViewer1.RefreshReport();
//ReportViewer1.DataBind();

Thanks,
Shafik

推荐答案

您缺少要附加的代码您的数据。



您应该拥有某种类型的数据源,可能是包含报告中所需信息的DataSet。然后像这样添加:



You are missing code to attach your data.

You should have a Data Source of some type, likely a DataSet that contains the information you want in the report. Then add it like this:

reportCaseByAgency.SetDataSource(myDataSet);


$ b设置ReportView1.ReportSource之前$ b



before setting the ReportView1.ReportSource.


这篇关于CrystalReportViewer中未显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆