Do not load data from MS SQL

Stimulsoft Reports.JS discussion
Post Reply
amamam
Posts: 4
Joined: Mon Oct 21, 2019 10:32 am

Do not load data from MS SQL

Post by amamam »

I use React and when load mrt file,the report do not load data from database.
My Component in react :

Code: Select all

import React from 'react';
class Viewer extends React.Component {
    render() {
        return <div id="viewerContent"></div>;
    }

       componentWillMount() {
        var report = new window.Stimulsoft.Report.StiReport();
        report.loadFile("reports/BaseProjRPT.mrt");

        report.dictionary.databases.clear();
        let connectionString = "Data Source=DESKTOP-J9;Initial Catalog=MasterDb;Integrated Security=True;User ID=amir;Password=1234";    
        let stiConnection = new window.Stimulsoft.Report.Dictionary.StiSqlDatabase("MSSQL1", "MSSQL1", connectionString);
           
         report.dictionary.databases.add(stiConnection);

        var options = new window.Stimulsoft.Viewer.StiViewerOptions();
        this.viewer = new window.Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
        this.viewer.report = report;
    }

    componentDidMount() {
        this.viewer.renderHtml("viewerContent");
    }
}
export default Viewer;
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Do not load data from MS SQL

Post by Lech Kulikowski »

Hello,

Please check the following article:
https://www.stimulsoft.com/en/documenta ... _bases.htm

Thank you.
amamam
Posts: 4
Joined: Mon Oct 21, 2019 10:32 am

Re: Do not load data from MS SQL

Post by amamam »

Hello,
Thank you Lech.
I resolve the problem but in code that download for node js server from above link, in package.json use version 3 of 'mssql' but
use ConnectionPool function that is for version 4 of 'mssql'.
Lech Kulikowski
Posts: 6259
Joined: Tue Mar 20, 2018 5:34 am

Re: Do not load data from MS SQL

Post by Lech Kulikowski »

Hello,

We are always glad to help you!

Thank you for the information.
Post Reply