Kromster Kromster - 4 months ago 11
Linux Question

Generate reports that query data from MS SQL database on Linux/CentOS?

I'm trying FastReport.Mono on Linux (CentOS 7) to see if I can make an app to generate reports. Example Mono app seems to work fine with PDF and JPG export from custom dataset.

Now I need to query data from MS SQL database. I have a sample report that works well under Windows, but fails on Linux:

private static void ReportExportJPG()
{
Report report = new Report();
report.Load(@"sql-report.frx");
report.Prepare(); // <<<--- Error here
...
}


Error message is:


Cant find object MsSqlDataConnection


Feature table says that MS SQL connectivity (nor ODBC, nor many others) is not available in FastReport.Mono. Does this mean it's entirely missing or I should use other ways and provide ready-made connection to FastReport somehow? If so - How?

P.S. Running Windows report generator with MS SQL connection under Wine works well, so I assume connecting to MS SQL from CentOS is somehow viable.

Answer

I was able to resolve this by adding the following to my project source:

using FastReport.Data;
using FastReport.Utils;

...

RegisteredObjects.AddConnection(typeof(MsSqlDataConnection));
Comments