USING fastreport with mysql database, The 'obj' parameter must be of DataConnectionBase type
Following the guideline I found in readme file about registering the dll programmatically :
- add the "FastReport.MySQL.dll" reference to your project;
- execute the following code once at the application start:
FastReport.Utils.RegisteredObjects.AddConnection(typeof(MySqlDataConnection));
I execute this in the loading event of my main form but I am getting an error message saying :The 'obj' parameter must be of DataConnectionBase type
and if I remove when I wanna run the report I am getting the error saying: can not found the object mysqldataconnection
development tool:va2015
Applicable object:webReport
- add the "FastReport.MySQL.dll" reference to your project;
- execute the following code once at the application start:
FastReport.Utils.RegisteredObjects.AddConnection(typeof(MySqlDataConnection));
I execute this in the loading event of my main form but I am getting an error message saying :The 'obj' parameter must be of DataConnectionBase type
and if I remove when I wanna run the report I am getting the error saying: can not found the object mysqldataconnection
development tool:va2015
Applicable object:webReport
This discussion has been closed.
Comments
Hello!
Make sure that you pass a class from FastReport.Data to `AddConnection`, not the standard ADO.NET `MySqlConnection`:
FastReport.Utils.RegisteredObjects.AddConnection(typeof(FastReport.Data.MySqlDataConnection));
Since you are using WebReport in a web application, you need to register the connection when the web application starts (for example, in Application_Start in Global.asax or when initializing the service before loading/rendering reports), rather than when a WinForms form is loaded.