水晶报表参数 [英] Crystal reports parameters
问题描述
朋友,
我正在使用C#使用Windows应用程序.由于对Crystal Report还是陌生的,我对此表示怀疑.
我正在通过传递两个参数来显示数据集中的报告.
传递完这两个参数后,我将数据绑定到数据集中.代码在下面给出
Friends ,
I am working with windows application with C#.As i am new to crystal reports am having a doubt.
I am displaying the report from dataset by passing two parameters.
After passing these two parameters i am binding the data into a dataset. The code is given below
Dataset ds1=new Dataset();
rptwithItemDetails cr = new .rptwithItemDetails();
cr.SetDataSource(ds1.Tables[0]);
crystalReportViewer1.ReportSource = cr;
crystalReportViewer1.Refresh();
因此,当报表加载时,将从数据集中加载.
我的要求是我必须在每个报告(4个字段)中设置一些报告标题.
因此,我正在从数据库表中获取该详细信息,并将其加载到另一个数据集中,例如"ds2".
如何将数据集中的值作为参数设置报表标题.
还是我可以选择其他选项? (请注意,报告标题具有四个字段,这些字段是从数据库表中提取的)
请帮帮我.
提前非常感谢.
So when the report loads it will load from the dataset.
My requirement is that i have to set some report heading in every report(4 fields).
So i am fetching that details from my database table and loaded into another dataset say ''ds2''.
How to pass that values in the dataset as parameters for setting report heading.
Or can i choose any other option? (Note that the report heading have four fields which is fetching from database table)
Please help me .
Thanks a lot in advance.
推荐答案
您可以在报表中使用参数
或
在报表标题中添加一个文本框.
将文本"框的名称"更改为"txtHead"
现在在您的应用程序中编写这些代码
You can use Parameter in report
Or
Add a Text box in the header of the report.
Change the "Name" of the Text box to say "txtHead"
Now in your application write those code
Dim objText As CrystalDecisions.CrystalReports.Engine.TextObject
objText = rptReport.Section4.ReportObjects("txtHead")
objText.Text = ds2.tables(0).rows(0)("HEADER")
请注意,此代码在VB.Net中.请以您的方式将其转换为C#
Note this code is in VB.Net. Please convert it in C# in your way
这篇关于水晶报表参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!