In this tip, you will see a fully fledged PostgreSQL notifications WinForms application created with VS 2013.
Introduction
This is a fully fledged PostgreSQL notifications Windows Forms application created with Visual Studio 2013.
There is also an updated version for VS2019 which uses Npgsql 4.1.5.
When searching the internet, I only found scraps of information on how to do notification events in PostgreSQL, but not a complete working example.
Using the Code
So here it is, the only thing that needs to be present is a database, the table and triggers will be created by the application.
I tested the old version with PostgreSQL 9.5 and the NpgSql 2.1.3 driver.
The updated version was tested with PostgreSQL 10.14 and NpgSql 4.1.5.
After pressing the <Start> button, listening starts with the PostgreSQL "listen mynotification
" command.
Notification events can be triggered from the application using the <Trigger> and <Insert row> buttons, and also by directly editing the database.
Points of Interest
More information can be found from the links below:
There is also a portable PostgreSQL version, I don't like the newest versions as they tend to be bigger and don't have PgAdminIII included with them, so my favourite remains version 9.4.5 which is only a 10 MB download.
You can download it from the link provided on top, or from:
History
- V 1.0 Old version
- V 2.0 New version for NpgSql 4.1.5