FastReport.NET开发系列
说明:该系列介绍FastReport.NET开发,主要业务场景用于企业工厂应用。
本篇文章可以使用将取数逻辑和处理数据逻辑写在设计模板中,外部传递参数即可调用。
样例展示
调用时传递一个预设参数,预览效果如下:
一、设置数据源
1.添加数据源
2.编写sql脚本
二、增加模板参数
设置查询对应参数
三、外部代码调用
try
{
FastReport.Report report = new FastReport.Report();
FastReport.Utils.Res.LoadLocale(Environment.CurrentDirectory + @"\Chinese (Simplified).frl");
string filename = Application.StartupPath + "\\rep\\0909.frx";
report.Load(filename);
report.SetParameterValue("cinvcode", "0002");
report.Show();
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
总结
具体设置已经全部完成,直接调用即可。