Is it possible to get data from MySQL and display it on RDLC Report? Actually, as long as you can store your data into DataTable, DataList, or Collection, it is very possible.
So, in this post, I will show you how to display MySQL Data on RDLC Report. And I use MySQL Connector Net for connecting to MySQL Database.
Further how to use MySQL Connector Net:
https://rani-irsan.blogspot.com/2019/11/connecting-vbnet-to-mysql-database.html
Once the connector is downloaded and installed, you can start to follow this step of this tutorial.
I've already made a desktop application with VB.NET language named RDLCMySQL.
We need to add MySQL Data as reference. Go to the solution explorer and right click on the project node then Add --> Reference....
The MySQLData.dll that is used must suit the Framework. The connector installer is 8.0.27 version and the Framework used is 4.5.2. So, I choose the Browse tab and go to C:\Program Files (x86)\MySQL\MySQL Connector Net 8.0.27\Assemblies\v4.5.2
Choose and add MySQL.Data.dll.
Check the checkbox of the selected file then click OK to add the reference.
The next step is adding a dataset to the report. If the report data panel is not displayed, call it from the "View --> Report Data" menu. Then on the Report Data, right-click on the DataSet folder, choose Add Dataset...
We've already selected DataSet1 for this table, so we can click the small icon on the top-right corner of each cell to choose what field will be displayin on it.
Then back to the Visual Studio in Solution Explorer, activate Show All Files icon, so modDatabase.vb will be displayed vague. Right click on it then choose Include In Project, so the file becomes part of the project.
We've done with the code, but before debug running, don't forget to set these 2 properties of the report file:
Both property will appear while we selecting Report1.rdlc in Solution Explorer. Build Action = Content, is used to inculde report file to the installer package. Copy to Output Directory = Copy always or we can also choose Copy if newer, it works to copy the report file to the debug folder.
1 Comments
Terimakasih