I want to raise an event in C# when any one user make an insert or an update to a certain table in SQL server via my C# program. As there are multiple users using the execution file in various locations, I can not do it using the C# cord alone.

For example, as soon as a new order is added in Reception, the kitchen must get a pop up with the details of the last order. I have used timer event and checked whether new records are there, but it is not good.

Please help.
Thanks in advance.

Write a class definition that can publish an event.

public delegate void TestMe(string what);
public class DBCentral {
    public event TestMe Inserted;
    public event TestMe Updated;
    ....

    public void AddRec(){
        .....
        ....  // Database stuff
        // Raise an event
       if(Inserted!=null) {
             Inserted("put_your_message_here");
       }
    }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.