I have a form to fill details, those records will inserted in db with columns name, email, phone, ismailsent. now i want to send an email to my admin team if any new record inserted into DB. any better technique like windows service, i want it to be very clean. any help appriciated
Asked
Active
Viewed 1,177 times
0
-
Show your current effort – Konstantin Dinev Jun 12 '13 at 07:15
-
i thought create `sql server trigger` is better than create window service. or after you insert value you send email with c# mail functionality – Sabilv Jun 12 '13 at 09:04
-
@sabil that might put too much load on db right. i am looking for faster and lighter way – charan Jun 18 '13 at 08:25
-
@charan so why not try to send email, after you success insert the data on your c# code behind, or if you use SP, how about insert email code there. – Sabilv Jun 18 '13 at 09:17
2 Answers
0
You don't give any details, but I guess you're looking for something like a database trigger. I don't know which DBMS you're using, but take a look at this post: C# / SQL Listener to tell me if a row has been inserted into a table
-
Then this is what you need: http://stackoverflow.com/questions/1355921/sql-server-2008-help-writing-simple-insert-trigger – Rob Jun 12 '13 at 07:25
0
There are a few options for achieving this functionality, you could have a windows service or a web service which you invoke after you insert your record successfully, or you could use the SQL Server 2008 build in functionality (sp_send_dbmail), but you first need to configure it. Here are some posts that might help you:
- How to use after insert trigger to send mail
- MSDN about sp_send_dbmail
- Configuring mail functionality in SQL Server 2008
Hope it helps. Cheers!