Our FastReport .NET has quite rich capabilities and wide functionality. Today we will look at connecting to the database using the FastReport plugin for the report designer.
Below is an example of the FastReport .NET installation path that would be: C:\Program Files (x86)\FastReports\WinForms
1. Go to the installation folder and then follow the path Extras\Core\FastReport.Data\FastReport.Data.Postgres
Important! The path should be exactly like this; there may be outdated projects along other paths.
2. We find there the project file FastReport.Data.Postgres.csproj in Visual Studio.
Important! There are several files in this folder, you need to open this one.
3. Several projects will open in Visual Studio. Select FastReport.Data.Postgres and right-click on it, and then click “Set as Startup Project” in the context menu.
4. Select the “Release” build and the “net462” target.
5. In the decision tree, expand the project -> Dependencies -> net462 -> Projects and Packages. Pay attention to the exclamation marks in the triangles.
6. Delete “FastReport” in “Projects”. We don’t delete anything else in the dependencies. Now you need to add nuget packages FastReport.N et and Npgsql .
Important! FastReport.Net must be added as a package, since the method of adding FastReport.dll no longer works.
7. In the “Dependencies” context menu, select “Manage NuGet Packages”.
8. You need to add two package sources: nuget.org and the source referring to our nuget-server, or to the local folder C:\ProgramFiles(x86)\FastReports\WinForms\Nugets.
9. Select the nuget.org source.
10. On the “Installed” or “Updates” tab, find the Npgsql package and click on it.
11. We look on the right and see the following information: the current version associated with the project is 3.2.7, the latest version of the package is 8.0.3, the Uninstall and Update buttons.
12. Click on the Update button.
13. Select the second package source. The example uses the Nuget Server of Fast Reports Inc.
14. Go to the Browse tab and enter fastreport.net in the search field
15. Select the FastReport.Net package or FastReport.Net.Demo for the trial version.
Important! It should be one of these two packages, as the FastReport.Net.Pro package is outdated and no longer used.
16. We carefully look at the version and select the one that we have installed. This manual covers 2024.2.12 version.
17. Click the Install button. We accept the license agreement and wait for the package to be installed.
18. Right-click on the FastReport.Data.Postgres project and click Build in the context menu.
19. At the bottom left we see the inscription “Build succeeded.” This means that the plugin is built correctly and Visual Studio can be closed.
20. Go to the folder where FastReport .NET is installed, as indicated at the beginning of the instruction, this is C:\Program Files (x86)\FastReports\WinForms. There should be "Designer.exe" here.
21. We move from this folder to the following folders along the path: Extras\Core\FastReport.Data\FastReport.Data.Postgres\bin\Release
22. We find 2 folders “net462” and “net6.0-windows7.0”, go to the net462 folder.
23. Copy the following files from this folder:
FastReport.Data.Postgres.dll,
Npgsql.dll,
Microsoft.Bcl.AsyncInterfaces.dll,
Microsoft.Extensions.Logging.Abstractions.dll,
System.Threading.Tasks.Extensions.dll,
System.Memory.dll
24. Paste the copied files into the folder where Designer.exe is located.
25. Run “Designer.exe”, go to the File -> Options menu (View -> Options if the Ribbon interface is disabled). Go to the “Plugins” tab.
26. If there is already a FastReport.Data.Postgres plugin, you need to remove it and repeat step 21.
27. Click on the “Add” button, go to the designer folder, in this example it is C:\Program Files (x86)\FastReports\WinForms
28. Select the FastReport.Data.Postgres.dll file and click the “Open” button. The plugin appears in the list.
29. Pay attention to the text at the bottom left, which indicates that the Designer needs to be restarted. Click the OK button. Close the designer.
30. Launch Designer.exe again. If you have followed this instruction, the connection to Postgres should appear in the list of connections.
31. If you see the following errors when trying to connect:
Then you need to close the designer, copy the file indicated in the error from the С:\Program Files(x86)\Fast Reports\WinForms \Extras\Core\FastReport.Data\FastReport.Data.Postgres\bin\Release\net462 to the folder where you have Designer.exe.
In FastReport .NET, it is very easy to assemble and connect various connectors to a variety of databases.