程序中使用变量向fastreport传值


 新建数据源

 

 

 

 输入表名,编写SQL语句。

 

 新建数据源时,使用SQL语句创建。变量使用@。

 

 C#程序中  添加对fastreport 的引用。

窗体添加previewControl 控件。

后台代码

 Report report = new Report();

report.SetParameterValue("orgno", sfz);
report.SetParameterValue("sex", orgno);

string Path = System.Environment.CurrentDirectory + "/test.frx";
report.Load(Path);

report.Preview = previewControl1;
previewControl1.Report.RegisterData(dsa);//dsa  DataSet      查询结果加载
report.GetDataSource(dsa.Tables[0].TableName).Enabled = true;
report.Prepare(); //准备
report.ShowPrepared(); //显示 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM