如何隐藏“参数值窗口”水晶报告10 [英] how to hide "Parameter Value window" crystal report 10
本文介绍了如何隐藏“参数值窗口”水晶报告10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用c#中的代码传递参数,但每次打开报告时都会打开参数值窗口...请帮助我...我的代码是
Hi,
I pass the parameters using code in c# but the "Parameter Value Window" is open every time I open the report...please help me in that..here is my code
void loadordinfo()
{
// here the query code.............
MySqlDataAdapter adpat = new MySqlDataAdapter(sltinfoord, conn);
ordset = new DataSet();
adpat.Fill(ordset, "orderbill");
ordtb = new DataTable();
adpat.Fill(ordtb);
objRpt = new CrystalReport4();
objRpt.SetDataSource(ordset);
}
private void pictureBox1_Click(object sender, EventArgs e)
{
try
{
crystalReportViewer1.ReportSource = objRpt;
}
catch (FormatException oleEx)
{
MessageBox.Show(oleEx.Message);
}
catch (Exception Ex)
{
MessageBox.Show(Ex.Message);
}
}
private void OrdersBillReport_FormClosing(object sender, FormClosingEventArgs e)
{
objRpt.Dispose();
objRpt.Close();
}
private void OrdersBillReport_Load(object sender, EventArgs e)
{
conn = new MySqlConnection(path.p);
CargoPrivateFontCollection();
CargoEtiqueta(font);
loadordinfo();
oo = new orgnization();
oo.orgnizationinfo();
crystalReportViewer1.ReuseParameterValuesOnRefresh = false;
objRpt.SetParameterValue("n", oo.organame.ToString());
}
}
推荐答案
使用此值将值传递给水晶报表中的参数
Use this to pass value to your parameter in crystal report
Using CrystalDecisions.Shared; //add this namespace;
ParameterFields paramfields = new ParameterFields(); //collection of parameters
ParameterField paramfield = new ParameterField(); //your parameter
ParameterDiscreteValue dsvalue = new ParameterDiscretValue(); // holder of your the value for the parameter
paramfield.Name = "Nameofparameter in crystal report"
dsvalue.Value = "the value you want to pass";
paramfield.CurrentValue.Add(dsvalue); //this assign the value to your parameter
paramfields.Add(paramfield); //add the parameterfield to the parameterfields collection
crystalReportViewer1.ParameterFieldInfo = paramfields; //this will assign the parameter fields to the report loaded in crystalreportviewer1
loadordinfo(); // call this method here
希望它有所帮助。
你也可以试试这个1.
hope it helps.
you can also try this 1.
private void OrdersBillReport_Load(object sender, EventArgs e)
{
conn = new MySqlConnection(path.p);
CargoPrivateFontCollection();
CargoEtiqueta(font);
oo = new orgnization();
oo.orgnizationinfo();
crystalReportViewer1.ReuseParameterValuesOnRefresh = false;
objRpt.SetParameterValue("n", oo.organame.ToString());
loadordinfo();
}
这篇关于如何隐藏“参数值窗口”水晶报告10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文