locked
Looking for simple sample RRS feed

  • Question

  • Hello

    I'm looking around for tutorials and samples for Notification Services applications for a while now, but I just can't find something that covers what I want to do. All I want is to check if a value in my Database changes or exceeds a specific value and then send a mail.

    Does anyone know a good sample that show's me how to do this or can anyone explain it in a couple of words?

    Thanks in advance!

    Thursday, May 25, 2006 10:53 AM

Answers

  • This is a fairly common scenario. Use the SQL Server Event Provider to query your database table, looking for new or changed records. In your Subscription Class, have each subscriber specify the threshold they are interested in and in the match rule compare the two to produce the notifications.

    The Stock sample application that comes with SSNS would be an excellent place to start. Just replace the FileSystemWatcher Event Provider with the SQL Server Event Provider and you're most of the way there.

    You'll probably want to use at least one Chronicles table to prevent unwanted/uninteresting notifications. For example, if the threshold is continually exceeded, you probably don't want to continually email your subscribers. To use the Stock sample to illustrate: if I want to know when Microsoft's stock exceeds $45/share. No big deal. But if on 5 consecutive generator firings the stock values are $44.90, $45.10, $45.20, $45.50, and $46.00, without careful planning you will have just generated 4 emails to me. To prevent the  unwanted notifications, use the chronicles table - either keep track of the highwater mark, or the fact that you've already sent out a notification, or whatever makes the most sense in your situation. BTW - if you have a copy of my book, I discuss this in Chapter 7, but I'll be glad to continue the conversation here, too.

    HTH...

    Joe

     

    Thursday, May 25, 2006 11:50 AM