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);
}
how to load tables when starting application
-
- Posts: 2
- Joined: Fri Dec 18, 2020 10:21 pm
-
- Posts: 7341
- Joined: Tue Mar 20, 2018 5:34 am
Re: how to load tables when starting application
Hello,
You should also add all data sources and columns.
Add DataSources:
Add Columns:
Thank you.
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);
Code: Select all
foreach (DataColumn col in dataTableDS1.Columns)
{
DS1.Columns.Add(col.ColumnName, col.DataType);
}
-
- Posts: 2
- Joined: Fri Dec 18, 2020 10:21 pm
Re: how to load tables when starting application
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.
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.
Re: how to load tables when starting application
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.
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.