Hi!
In MVC:
string connstr = GetStimulsoftConnString(something);
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("MS SQL", connstr));
"MS SQL" is datasource in the Myreport.mrt.
How can I do this in Blazor? (error: StiSqlDatabase couldn't be found)
Thanks
Attila
Blazor - set connectionstring dynamically
-
- Posts: 201
- Joined: Tue Sep 07, 2021 10:11 am
Re: Blazor - set connectionstring dynamically
Hello,
We couldn't reproduce the issue.
Please send us a sample project that reproduces the issue.
Thank you.
We couldn't reproduce the issue.
Please send us a sample project that reproduces the issue.
Thank you.
Re: Blazor - set connectionstring dynamically
Hi Max!
I figured out a solution.
I have a request: 3173721 I send the project a few days ago.
If you insert these 3 lines (bold, italic - Set connectionstring), then you get the problem:
//Load report template
report.Load("Pages/BlazorReport.mrt");
// Set connectionstring
string connstr = "Data Source=PC\\INSTANCE1;Initial Catalog=DatabaseName;Integrated Security=False;Persist Security Info=True;User ID=usern;Password=passw;Connect Timeout=100";
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("MS SQL", connstr));
//Render, w/out showing progress
report.Render(false);
Error: StiSqlDatabase could not be found.
In the mrt report, I set a connectionstring, but I have much database and I must set the appropriate one in the program.
Attila
I figured out a solution.
I have a request: 3173721 I send the project a few days ago.
If you insert these 3 lines (bold, italic - Set connectionstring), then you get the problem:
//Load report template
report.Load("Pages/BlazorReport.mrt");
// Set connectionstring
string connstr = "Data Source=PC\\INSTANCE1;Initial Catalog=DatabaseName;Integrated Security=False;Persist Security Info=True;User ID=usern;Password=passw;Connect Timeout=100";
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("MS SQL", connstr));
//Render, w/out showing progress
report.Render(false);
Error: StiSqlDatabase could not be found.
In the mrt report, I set a connectionstring, but I have much database and I must set the appropriate one in the program.
Attila
-
- Posts: 201
- Joined: Tue Sep 07, 2021 10:11 am
Re: Blazor - set connectionstring dynamically
Hi Max!
It's amazing. It works fine now. Thank you very much.
------------------------
I have another problem - I hope this is the last one for now.
Export to Html is OK.
Export to Pdf is not.
I set the text font in the report mrt to Cuorier New.
Error: Exception in PdfFonts.GetFontMetrics, font 'Courier New' step #10: 'Object reference not set to an instance of an object.'
2 lines:
- StiReportResponse.ResponseAsPdf(report);
- report.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, _exportFilePath);
Why is that? (I need this feature very much.)
Thanks
Attila
It's amazing. It works fine now. Thank you very much.
------------------------
I have another problem - I hope this is the last one for now.
Export to Html is OK.
Export to Pdf is not.
I set the text font in the report mrt to Cuorier New.
Error: Exception in PdfFonts.GetFontMetrics, font 'Courier New' step #10: 'Object reference not set to an instance of an object.'
2 lines:
- StiReportResponse.ResponseAsPdf(report);
- report.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, _exportFilePath);
Why is that? (I need this feature very much.)
Thanks
Attila