how to load tables when starting application

Stimulsoft Reports.NET discussion
Post Reply
rodrigo.santos
Posts: 2
Joined: Fri Dec 18, 2020 10:21 pm

how to load tables when starting application

Post by rodrigo.santos »

Hi guys, i'm learning to use stimulsoft, an information that i didn't quite understand, it was like loading the tables of a postgreeSQL connection. In other words, when starting the application it fetches from the database all the tables with their columns and having autorefresh. My application is ASP NET CORE. (My english not is so good)

//My code
public IActionResult GetReport()
{
StiReport report = new StiReport();
report.Dictionary.Databases.Add(new StiPostgreSQLDatabase("TMS", "User Id = user; Password = password; Host = localhost; Database = tms"));
return StiNetCoreDesigner.GetReportResult(this, report);
}

Not carry the tables
Not carry the tables
Capturar.PNG (3.62 KiB) Viewed 1567 times
Lech Kulikowski
Posts: 7341
Joined: Tue Mar 20, 2018 5:34 am

Re: how to load tables when starting application

Post by Lech Kulikowski »

Hello,

You should also add all data sources and columns.
Add DataSources:

Code: Select all

 StiSqlSource DS1 = new StiSqlSource("Connection", "DS1", "DS1", "SELECT * FROM DS1", true, false);
 report.Dictionary.DataSources.Add(DS1);
Add Columns:

Code: Select all

 foreach (DataColumn col in dataTableDS1.Columns)
 {
      DS1.Columns.Add(col.ColumnName, col.DataType);
 }
Thank you.
rodrigo.santos
Posts: 2
Joined: Fri Dec 18, 2020 10:21 pm

Re: how to load tables when starting application

Post by rodrigo.santos »

Hi man,
I understood the logic to be implemented. but how do I select it to get all the tables from the database. In order to test I did the "Select * from Customers" but even so he does not create the columns. (use postgreSQL)


Thanks for your help.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: how to load tables when starting application

Post by HighAley »

Hello,

If you are adding the data sources to the report with the external code, you should know the names of the tables.
There is no easy way to add the SQL data sources. You should add connection, SQL queries and all columns with your code.

Thank you.
Post Reply