将参数传递给crystalreport [英] pass parameter to crystalreport

查看:64
本文介绍了将参数传递给crystalreport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用C#和水晶报表,我想在水晶报表中打印一个表并从表单中传递变量值,我之前使用SetParameterValue做了它并且它有效,但是这个时间我以相同的方式传递值但是当打印表单打开时需要再次由用户输入参数值,有什么问题?

解决方案

参考下面的链接:





http://www.aspdotnet-suresh.com/2012/01/pass-parameters-to-crystal-reports -in.html


在我尝试了没有结果的所有解决方案之后,我在打印表单中发现问题,当它加载时有自动添加行来刷新报表所以所有参数都丢失了值I通过



谢谢


例如:





 CrystalReport1 cr =  new  CrystalReport3(); 
cr.DataDefinition.FormulaFields [ ID]。text = ' + textBox22.Text + '; // 这是一个表格中的文本框
cr.DataDefinition.FormulaFields [ 名称]。文本= + textBox21.Text + ';
cr.DataDefinition.FormulaFields [ ]。文本= ' + textBox20.Text + ';
cr.DataDefinition.FormulaFields [ 年龄]。文本= ' + textBox24.Text + ';
cr.DataDefinition.FormulaFields [ Location]。text = ' + textBox23.Text + ';
crystalReportViewer3.ReportSource = cr;
cr.PrintToPrinter( 1 false 1 1 );





比在crystalreportviewer中添加公式....

如果你有任何请问问。


Hi ,
I am using C# and crystal report , I want to print a table in crystal report and pass variable value from the form , I did it before with SetParameterValue and it worked, but this time I pass the value same way but when the print form open it requires the parameter value again to be entered by user, what is the problem?

解决方案

Refer Below link:


http://www.aspdotnet-suresh.com/2012/01/pass-parameters-to-crystal-reports-in.html


After I tried all solutions with no results , I found the problem in the print form when it load there is auto added line to refresh the report so all parameter lost values I passed

Thanks


for example :


CrystalReport1 cr = new CrystalReport3();
cr.DataDefinition.FormulaFields["ID"].Text = "'" + textBox22.Text + "'"; // this is a textbox in form
cr.DataDefinition.FormulaFields["Name"].Text = "'" + textBox21.Text + "'";
cr.DataDefinition.FormulaFields["Surname"].Text = "'" + textBox20.Text + "'";
cr.DataDefinition.FormulaFields["Age"].Text = "'" + textBox24.Text + "'";
cr.DataDefinition.FormulaFields["Location"].Text = "'" + textBox23.Text + "'";
crystalReportViewer3.ReportSource = cr;
cr.PrintToPrinter(1, false, 1, 1);



than add formula into crystalreportviewer....
if u have any troble please ask.


这篇关于将参数传递给crystalreport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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