locked
trigger from sql server to C# application RRS feed

  • Question

  • Hi,

    I have a trigger with a table that has large amount of data, that checks if required data bit is inserted into the table. Is it possible that capture this trigger via C# application? Like in the table 0000 is being inserted continousouly. When 1111 is inserted in the table I could notify the user on C# that 1111 is inserted. 

    Thanks.

    Maverick
    Tuesday, September 1, 2009 7:56 AM

Answers

  • Hi,

    I think the best way is to check the data validation in the trigger and capture the error raised by the trigger in C# application.

    Trigger: Create a trigger for the insert operation. If the input data is invalid, you could use RAISERROR statement to initiate an error processing, such as RAISERROR ('Invalid Data', 10, 1).
    C# application: You could use try…catch… statement to capture that error.

    If there are any more questions, please let me know.
    Thanks.
    ***Xiao Min Tan***Microsoft Online Community***
    Thursday, September 3, 2009 5:28 AM