水晶报表无法显示数据 [英] crystal report not able to display data

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

问题描述

  double 每月= Convert.ToDouble(ds1.Tables [ 0 ].Rows [ 0 ] [" ].ToString());
             double  Qtr = Convert.ToDouble(ds1.Tables [ 0 ].Rows ["   Qtr"].ToString());
             double  halfYearly = Convert.ToDouble(ds1.Tables [ 0 ].Rows ["  上半年" ].ToString());
         double  totamt = Convert.ToDouble(ds2.Tables [ 0 ].Rows ["  已收到金额"].ToString());
          
CrystalReport2 report =  CrystalReport2();
            report.SetDataSource(ds1.Tables [ 0 ].Rows [ 0 ] [ 上半年"].ToString());
            report.SetDataSource(ds2);
            report.SetDataSource(ds1.Tables [ 0 ].Rows [ 0 ] [ 每月"].ToString());
         
            crystalReportViewer1.ReportSource =报告; 



我想要以下格式的水晶报表
每月:(每月价格)
半年:(半年值)
总计:(totamt)


我已经在设计视图中获取了数据集,添加了数据表并获得了相应的汇总
到数据表并编写上述用于显示报告的代码,但显示空白数据是什么问题,这里有人帮帮我吗?让我逐步为您提供另一个过程:

1.将数据集添加到设计视图中后,首先使用数据集设计Crystal报表.
2.创建所创建的Crystal报表对象.

 CrystalReport2报告=  CrystalReport2(); 


3.设置Crystal Report对象的数据源属性.

 report.SetDataSource(ds1.Tables [ 0 ]); 


4.将报表对象传递给CrystalReportViewer.

crystalReportViewer1.ReportSource = report;




这应该可以解决问题.有关更多信息,请参考以下链接.
使用C#的具有DataSet和DataTable的水晶报表 [ ^ ]


double monthly = Convert.ToDouble(ds1.Tables[0].Rows[0]["Monthly"].ToString());
            double Qtr = Convert.ToDouble(ds1.Tables[0].Rows[0]["Qtr"].ToString());
            double halfYearly = Convert.ToDouble(ds1.Tables[0].Rows[0]["halfYearly"].ToString());
        double totamt = Convert.ToDouble(ds2.Tables[0].Rows[0]["AmountReceived"].ToString());
          
CrystalReport2 report = new CrystalReport2();
            report.SetDataSource(ds1.Tables[0].Rows[0]["halfYearly"].ToString());
            report.SetDataSource(ds2);
            report.SetDataSource(ds1.Tables[0].Rows[0]["Monthly"].ToString());
         
            crystalReportViewer1.ReportSource = report;



i want crystal report in following format
Monthly :(monthlyamt value)
half yearly:(half yearly value)
Total:(totamt)


i have taken dataset in design view ,added datatable and curresponding coulmn
to datatable and write above code for displaying report but is show blank data whats wrong here somebody help me?

解决方案

Your process doesn''t seem write. Let me give you another process step by step:

1. As you have added the dataset in design view, first design the Crystal report using your dataset.
2. Create the object of Crystal report as you have created.

CrystalReport2 report = new CrystalReport2();


3. Set the data source property of Crystal Report Object.

report.SetDataSource(ds1.Tables[0]);


4. Pass the report object to CrystalReportViewer.

crystalReportViewer1.ReportSource = report;




This should do the trick. For more information you can refer to following link.
Crystal Report with DataSet and DataTable using C#[^]


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

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