How to Build a .NET RDL Report Using PostgreSQL
PostgreSQL is one of the most used open-source data sources. It has an interface that makes it easier to use than MySQL.
Recently one of our customers asked how to bind ActiveReports to a PostgreSQL database, so I decided to write this blog article to help other customers who work with PostgreSQL.
Create a Table in PostgreSQL
First, we create a table named simple_table in the PostgreSQL pgAdmin panel.
Set Up a Data Source for the Report
I want to create an RDL report and bind it to the simple_table in MyTestDataBase using PostgreSQL.
I'm using the ODBC driver (PostgreSQL Unicode 32/64 bit) provided by PostgreSQL Global Development Group to connect my RDL report to PostgreSQL. If you haven't installed the PostgreSQL driver, you can follow the steps in the first part of this article.
Now we can link the data source to our RDL report using a connection string like this:
Driver={PostgreSQL UNICODE};Server=localhost; Port=5432;
Database=MyTestDataBase; Uid=postgres; Pwd=123456;
Now we add a data set to the data source using a SQL query like this:
SELECT * FROM simple_table
Design the Report
Now we are all set to design the report with the data set. Let's drop a Table onto the report and bind it to the dataset fields.
So we have created an RDL report bound to a PostgreSQL database without writing a single line of code. Amazing, right?
Let's preview the report and see how it looks.
Pretty cool stuff!
Download the sample application complete with a database backup that you can restore using your PostgreSQL admin panel.
Download the latest version of ActiveReports.NET.