如何从会话创建水晶报表 [英] how to create crystal report from session
问题描述
我是Crystal报表的新手,如何使用会话plz中的数据创建报表,请帮助我
im new to crystal report how to create a report using data from session plz help me
推荐答案
如果您提供问题的简要说明.我们可以更好地理解它.
-------------------------------------------------- --------------------
但是关于你这个问题:-
将从会话中检索到的数据保存在一个变量中.
将Crystal报表中的参数用于文本字段和参数字段.
尝试使用以下代码在参数中显示数据:-
陈述式:-
If you give brief detail of your question. we can understand it better.
----------------------------------------------------------------------
but as for your this question:-
save the data retrieved from session in an varaible.
use the parameters in crystal reports for text fields and parameters fields.
Try this code for showing the data in parameters:-
Declarative :-
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.ReportSource;
代码部分:-
对象声明:-
ParameterFields paramFields =新的ParameterFields();
ParameterField paramField;
ParameterDiscreteValue paramDiscreteValue;
Inq_Report2 objRpt;
使用此功能:-
"int i"表示参数编号,"string e"表示要显示的值.
code part:-
Objects Declarations:-
ParameterFields paramFields = new ParameterFields();
ParameterField paramField;
ParameterDiscreteValue paramDiscreteValue;
Inq_Report2 objRpt;
use this function:-
''int i'' refers to parameters no., and ''string e'' refers to the value which you want to show.
public void runtime_param(int i, string e)
{
paramField = new ParameterField();
paramField.Name = "col" + i.ToString();
paramDiscreteValue = new ParameterDiscreteValue();
paramDiscreteValue.Value = e;
paramField.CurrentValues.Add(paramDiscreteValue);
//Add the paramField to paramFields
paramFields.Add(paramField);
}
在
void button1_click()
{
runtime_param(3,会话数据");
crystalReportViewer1.ParameterFieldInfo = paramFields;
如果要使用,其中"ds"是数据集.
on
void button1_click()
{
runtime_param(3, "session data");
crystalReportViewer1.ParameterFieldInfo = paramFields;
where ''ds'' is a dataset if you want to use.
objRpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = objRpt;
con.Close();
}
-------------------------------------------------- -----------------------------
如果您有任何问题,请告诉.
谢谢您的问题.
}
-------------------------------------------------------------------------------
if you have any problem just tell.
Good Regards for your problem.
这篇关于如何从会话创建水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!