Best approach to generate service side reports

Stimulsoft Reports.NET discussion
Post Reply
springer
Posts: 1
Joined: Thu Jan 03, 2019 3:09 pm

Best approach to generate service side reports

Post by springer »

Hi Stimulsoft,
I want to generate template reports with your designer and want to send them to my service.
The service should open the report, look for some extra values that need to be added to the sql query and fill in/render the appropriate data from a MSSQL database and save them as pdf.
Each report should store the information it needs to generate itself (e.g. customerid, categroy type etc.) or maybe the sql query string ideally without containing any connection string.

Currently I'm using the .net wpf designer to connect to a MSSQL database, paste in my select-statement, generate the columns from it automatically and drag this datasource I get from it into the template as my databand.
Then i save it and will later load it in the service (report.Load("./mytemplate").

The problem is, I dont want to save the connection string in the template but I need it in the Designer to connect to the database and generate the datasource easily.
If I remove the connection string in the designer afterwards I cannot add it somehow afterwards again in the service (or can I?). Also there is no class like StiMSSqlDatabase, do delete all current databases and re-add it in the service again after loading the report.

I already found this method with datasets: https://www.stimulsoft.com/en/documenta ... g_data.htm
but how does my report template have to look like then?
I already read about business objects but then I would have to generate a business object for each report even if I dont need it in the service because there I want to directly fill in my data from the database and not map it into a business object and register it then with my report.

There are so many options, I'm kind of overtaxed.
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Best approach to generate service side reports

Post by Lech Kulikowski »

Hello,

- You can remove a connection string from the report before saving. And then after load report in your service provide it:
((StiSqlDatabase)report.Dictionary.Databases[ "Connection"]).ConnectionString = ""

- You can add restrictions on your database connection:
report.Dictionary.Restrictions.Add("ConnectionName", Stimulsoft.Report.Dictionary.StiDataType.Database, StiRestrictionTypes.DenyShow);

- You can prepare all necessary data in your code and then provide it to the report as DataSet with RegData() method.

Thank you.
Post Reply