Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody,

I am a .NET S/W Engineer. I have a problem in Windows Service i.e My windows service has to execute automatically and send SMS as soon as a row inserted in the table. I have created, deployed and installed my windows service successfully. but when I inserted into the table from my other project, my windows service is not executing. please give sample code with explanation on the same.
Posted
Updated 3-May-12 23:08pm
v2
Comments
Mantu Singh 3-May-12 9:35am    
I hope windows services run automatically after deployment when system starts.........

1 solution

If you want to send the email as soon as a rows is inserted then may be you should try to send email via SQL Server and not windows service.

Have a look here: SQL SERVER – 2008 – Configure Database Mail – Send Email From SQL Database[^]

If you want to send it via Windows service then, may be add a new table in your DB to track new records or a new column in the existing table(where row is being added) that will keep a track if email sent for it or not. Windows service will keep pinging your DB table at certain interval. For example, 5 min, then every 5 minutes it will check if any new record was added in last 5 min. If so, an email will be sent regarding the same.

Decide by yourself, what you need based on requirement.
 
Share this answer
 
Comments
VJ Reddy 4-May-12 0:04am    
5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900