Monday, March 26, 2012

RowChanged

I'm trying to put a fix in on a web page I did awhile back. The email occasionally goes down on it. So I was going to write emails to a SQL Server Table, then every two minutes check for entries in the table, and send out the email if any exist, on success remove the record. I've done this. But running a thread for the life of the application and querrying every 2 minutes seems a little overkill. How can I, with C#/ASP.NET get an event for when a record is added to the database, so I can start the thread then, and also end it after it has successfully sent out all queued emails?

I've seen RowChanged, but not a lot of documentation on it's use, ie, does there have to be an open connection the whole time? Does there have to be a class overridden to catch the event?You should use a SQL Trigger.|||Actually, I'd probably create a SQL Server Agent Job that did that. You could schedule it to fire every couple of minutes. It's a service that's probably already running.

David

No comments:

Post a Comment