Cloud
Cloud-Dienstleistung für schnelle und effektive Analyse und Visualisierung von Daten für Ihr Business ohne eigene Applikationen zu erstellen oder zu programmieren.
@Component({
selector: "using-sql-datasources",
imports: [Viewer],
template: `<sti-viewer [report]="report"></sti-viewer>`
})
export class UsingSqlDataSources {
report: Stimulsoft.Report.StiReport;
constructor() {
Stimulsoft.StiOptions.WebServer.url = "http://localhost:9615/";
this.report = new Stimulsoft.Report.StiReport();
this.report.loadFile("Reports/SimpleListSQL.mrt");
this.report.onBeginProcessData = function (args) {
// In this event, it is possible to handle the data request, and replace the connection parameters
// You can change the connection string
// This example uses the 'Northwind' SQL database, it is located in the 'Data' folder
// You need to import it and correct the connection string to your database
if (args.connection === 'MySQL')
args.connectionString = 'Server=localhost; Database=northwind; UserId=root; Pwd=;';
// You can change the SQL query
if (args.dataSource === 'customers')
args.queryString = 'SELECT * FROM MyTable';
}
}
}onBeginProcessData event exposes args.connectionString and args.queryString; replacing them per connection or data source lets one template target different databases. Requests are proxied through StiOptions.WebServer.url.