USING fastreport with mysql database
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
- 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
This discussion has been closed.
Comments
I saw your post may be you got some result please reply. i am getting error like ..
Error 1 The type or namespace name 'Utils' does not exist in the namespace 'FastReport' (are you missing an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\AssemblyInitializer.cs 4 18 FastReport.MySQL
Error 7 The type or namespace name 'Utils' does not exist in the namespace 'FastReport' (are you missing an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlConnectionEditor.cs 10 18 FastReport.MySQL
Error 2 The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlDataConnection.cs 5 7 FastReport.MySQL
Error 8 The type or namespace name 'MySql' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlConnectionEditor.cs 11 7 FastReport.MySQL
Error 6 The type or namespace name 'Forms' does not exist in the namespace 'FastReport' (are you missing an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlConnectionEditor.cs 9 18 FastReport.MySQL
Error 9 The type or namespace name 'DataConnectionBase' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlDataConnection.cs 11 38 FastReport.MySQL
Error 13 The type or namespace name 'Controls' does not exist in the namespace 'FastReport' (are you missing an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlConnectionEditor.Designer.cs 185 24 FastReport.MySQL
Error 3 The type or namespace name 'ConnectionEditors' does not exist in the namespace 'FastReport.Data' (are you missing an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlDataConnection.cs 6 23 FastReport.MySQL
Error 4 The type or namespace name 'ConnectionEditors' does not exist in the namespace 'FastReport.Data' (are you missing an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlConnectionEditor.cs 8 23 FastReport.MySQL
Error 10 The type or namespace name 'ConnectionEditorBase' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlConnectionEditor.cs 15 48 FastReport.MySQL
Error 12 The type or namespace name 'ConnectionEditorBase' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlDataConnection.cs 91 21 FastReport.MySQL
Error 11 The type or namespace name 'CommandParameterCollection' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\MySqlDataConnection.cs 61 7 FastReport.MySQL
Error 5 The type or namespace name 'AssemblyInitializerBase' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Administrator\Downloads\FRNetConnections\Extras\Connections\FastReport.MySQL\AssemblyInitializer.cs 8 38 FastReport.MySQL
How did you solve this problem? I also encountered this problem.
Thanks
Hello!
Add the FastReport.Data.MySQL package (or FastReport.OpenSource.Data.MySQL for the open-source version) of the same version as your main FastReport package, as well as the latest FastReport.Data.MySQL.
When building manually from Extras\Connections\FastReport.MySQL:
Open FastReport.Data.MySQL.csproj, remove any broken references, and add references specifically to your current FastReport.dll (and FastReport.Bars.dll if necessary) and FastReport.Data.MySQL.dll.
Make sure the target framework (TargetFramework) matches your application project, and rebuild the library.
Registration upon application startup (before any .frx files are loaded):
FastReport.Utils.RegisteredObjects.AddConnection(typeof(FastReport.Data.MySqlDataConnection));