C# / SQL Listener to tell me if a row has been inserted into a table

前端 未结 7 1118
傲寒
傲寒 2020-12-15 10:44

Can someone post sample code or tell me how to set up a listener to notify me (trigger an event) if a new row is inserted into a SQL Server database?

I don\'t want

7条回答
  •  轮回少年
    2020-12-15 11:36

    You would need to do some sort of database trigger on insert or poll the database regularly to look for new records. I don't recommend the latter suggestion as that can be very performance intensive.

    Other than that, you aren't giving us much to go on. What version of SQL Server are you using? What have you tried already? What problems have you encountered?


    Here are a few links that might point you in the right direction:

    Exploring SQL Server Triggers

    How to: Create and Run a CLR SQL Server Trigger

    A similar question that suggests an alternative (better?) way of doing this: Can SQL CLR triggers do this? Or is there a better way?

提交回复
热议问题