Reputation: 49
I am working on a c# project. I used stimulsoft to create and show report in my project. I design my report in stimulsoft software and save my report file in ...\bin\debug\reports path.
this is my report design :
this report shows system users.
Now, i want to filter my report in 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();
Upvotes: 0
Views: 2725
Reputation: 216293
This example is partially taken from their file 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
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. If you have a different database engine then please use one of the various StiXXXXXXDatabase
classes available
Upvotes: 0