[英]c# how to filter stimulsoft report programatically?
I am working on ac# project. 我正在从事ac#项目。 I used stimulsoft to create and show report in my project.
我使用stimulsoft在我的项目中创建和显示报告。 I design my report in stimulsoft software and save my report file in ...\\bin\\debug\\reports path.
我在stimulsoft软件中设计报告,然后将报告文件保存在... \\ bin \\ debug \\ reports路径中。
this is my report design : 这是我的报告设计:
enter image description here 在此处输入图片说明
this report shows system users. 此报告显示系统用户。
Now, i want to filter my report in c#. 现在,我想用c#过滤报告。 how can i send formul to filter my report result?
我如何发送表格过滤报告结果?
this is my code to show report: 这是我要显示报告的代码:
StiReport report = new StiReport();
report.Load(System.AppDomain.CurrentDomain.BaseDirectory + "\\reports\\userinfo.mrt");
report.Show();
This example is partially taken from their file Stimulsoft_NET_FAQ.pdf
本示例部分摘自其文件
Stimulsoft_NET_FAQ.pdf
First you create a parameter in the query used to extract data from the datasource 首先,您在查询中创建一个参数,用于从数据源中提取数据
SELECT * from Users WHERE userID = @userID
then you pass this parameter before calling Show 然后您在调用Show之前传递此参数
StiReport report = new StiReport();
report.Load(.... your file....));
report.Dictionary.Databases.Clear();
StiSqlDatabase db = new StiSqlDatabase("the_name_of_datasource", "the connection string");
report.Dictionary.Databases.Add(db);
report.CacheAllData = true;
report.Dictionary.Synchronize();
report.Compile();
// Finally set the parameter
report["@userID"] = 1; // <= value to search for....
report.Show(true);
This example is for an Sql Server Database backend. 本示例适用于Sql Server数据库后端。 If you have a different database engine then please use one of the various
StiXXXXXXDatabase
classes available 如果您使用其他数据库引擎,请使用各种可用的
StiXXXXXXDatabase
类之一
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.