Reg:Crystal Report Report Document [英] Reg: Crystal Report Report Document

查看:94
本文介绍了Reg:Crystal Report Report Document的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在Win Forms中使用水晶报告。记录值填入数据表,但未在报告文档中显示。



如何恢复这个?在这里我的代码。

如何恢复这个?

Hi,

Am using crystal report in Win Forms. The record values fill in to data table, but not shown in report document.

How can recover this one?. Here my code.
How can recover this one?

Query = "Select StudentId, TypeofInome, CourseName, CourseFee, BookFee, Paid, Balance, BillNo, Total, Curdate from tblInc where BillNo  = '" + InvoiceNo + "'";
                  StrPath = AppDomain.CurrentDomain.BaseDirectory + "\\Report\\myCrystalRep.rpt";
                  ReportDocument ObjRepDoc1 = new ReportDocument();
                  SqlDa = new SqlDataAdapter(Query, SqlCon);
                  DataTable dt = new DataTable();
                  dt.Clear();
                  SqlDa.Fill(dt);
                  myCrystalRep myRep = new myCrystalRep();
                  myRep .SetDataSource(dt);
                  crystalReportViewer1.ReportSource = myRep ;
                  crystalReportViewer1.Refresh();
                  ObjRepDoc1.Load(StrPath);
                  ObjRepDoc1.PrintToPrinter(NoofCopy, false, 0, 0);



先谢谢


Thanks in Advance

推荐答案

编码顺序错误。

首先你应该加载报告文件&然后将 ReportDocument 分配给 CrystalReportViewer 。所以它应该如下所示。

The order of coding is wrong.
First you should load the report file & then assign the ReportDocument to CrystalReportViewer. So it should be like below.
ReportDocument1.Load(StrPath);
crystalReportViewer1.ReportSource = ReportDocument1;
crystalReportViewer1.Refresh();



你的代码中不需要 PrintToPrinter 方法,因为你我只想查看报告。


And there's no need for PrintToPrinter method in your code because you wanted only to view the report.


这篇关于Reg:Crystal Report Report Document的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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