Triggers is how you would do this. If you are using SQL Server it is possible to write modules in C# that can be executed by the server. It would be easier just to have the client poll the DB for info.
I do have to ask, though, why save the message in the DB? Have you considered a 3-tier solution (Server, Client, DB)?
If both X and Y are polling the database at frequent intervals like say every 5 second, then you would not need to write triggers. AJAX could get the data to either from DB.
You may refer to this artiele as a starting point.
On a side note, you have not indicated if this is web based or a windows based application. Both can be in C# .....
"5. DB instantly sends sql result"
It obviously states that AJAX is not capable to solve that. But thanks for trying to help. Maybe any more ideas? And I do not care whether for web or windows based :) Both will be fine.
Edit: Thanks for a link. I had already reviewed it tho.