窗口服务,用于更新数据 [英] window service for update the data
本文介绍了窗口服务,用于更新数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将窗口服务与任务计划程序一起使用,以每5分钟运行一次此服务,并且每5分钟更新数据库表一次.
但是问题是当我们启动服务时,它会更新表,但是每隔5分钟服务就会运行,但数据不会更新.
如何解决这个问题?
谢谢
I am using a window service with a task scheduler to run this service on every 5 minutes and every 5 minutes it updates the database table.
but the problem is when we start the service then it update the table but on every 5 minutes service is running but the data is not updated.
how to solve this problem??
thanks
推荐答案
如果使用的是System.Timers.Timer
,请确保设置以下内容:
If you are usingSystem.Timers.Timer
make sure you set the following :
timer.AutoReset = true;
因此它将继续并且不会在第一次事件后停止.
So it will continue and not stop after the first time event.
这篇关于窗口服务,用于更新数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文