如何在asp.net&中设置计时器C#? [英] How to set a timer in asp.net& C#?

查看:92
本文介绍了如何在asp.net&中设置计时器C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中保存了几个数据,并根据输入的时间将表中的两个数据分类.24小时表状态中的数据将更改为过期,其他数据状态为打开。如何设置。

I was saved several data in database and categorized the both data in the table based on time when it entered.24hrs data in the table status will change as "Overdue" and other data status are "Open".how it set.

推荐答案

最好使用SqlServer预定作业来实现此功能。请尝试使用此链接创建预定作业

http://www.c-sharpcorner.com/UploadFile/ raj1979 / create-and-schedule-a-job-in-sql-server-2008 / [ ^ ]

希望这有助于
It's better to use SqlServer scheduled job to achieve this functionality.Please try this link for creating Scheduled Job
http://www.c-sharpcorner.com/UploadFile/raj1979/create-and-schedule-a-job-in-sql-server-2008/[^]
Hope this helps


您可以在SQL Server中创建作业,而不是C#或JQuery。与Windows调度程序类似,您创建的作业将在固定时间(或一天数次)每天运行。这个作业执行一个或多个命令(可以调用存储过程)。



查看此处了解详情 [ ^ ]



在那份工作中你会打电话给



You can create jobs in SQL Server, no C# or JQuery. Similar to windows scheduler, you create a job that will run daily at fixed time (or several times a day). This job executes one or more commands (can be calls to stored procedures).

See here for details[^]

In that job you would call

UPDATE your_table 
SET
    status = "Overdue" 
WHERE
    DATEDIFF('hh', date_entered , GetDate()) > 24





注意我从内存中写了datediff,参数顺序可能是不同的



如果这有帮助,请花时间接受解决方案,以便其他人可以找到它。谢谢。



Note that I wrote datediff from memory, order of parameters may be different

If this helps, please take time to accept the solution so that other may find it. Thank you.


这篇关于如何在asp.net&中设置计时器C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆