如何让页面自动运行 [英] How Do I Get A Page To Run Automaticlly

查看:66
本文介绍了如何让页面自动运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

再次问好老友,



回到另一个问题。我已经构建了一个webform,它将检查数据库中开始时间的记录,从现在开始不到15分钟,另一次检查同一页面上的结束时间不到15分钟。然后将数据绑定到单独的gridview。



如果gridview的行数大于0,则页面会向admin发送电子邮件。



我们的想法是发送提醒电子邮件,说明预订将在15分钟后开始,而另一个则说预订将在15分钟后结束。



问题是,如何让这个页面每15分钟自动运行一次,以便它始终检查数据库?我有它工作,但它需要每15分钟自动运行。



感谢您的帮助。

解决方案

Scott Hanselman写了博客文章 [ ^ ]去年比较了在ASP.NET应用程序中安排后台任务的不同选项。


对于快速解决方案,您可以使用内置的html方式:

 <   head  >  
< meta http-equiv = 刷新 < span class =code-attribute> content = 15 >
< / meta > < / head >



http://www.w3schools.com/tags/att_meta_http_equiv.asp [ ^ ]



但是如评论中提到的某种计划任务将是最好的方式。



在数据库方面你可能想要查看SQL Server代理。



这些链接可能有所帮助:

https://msdn.microsoft.com/en-us/library/ms189237.aspx [ ^ ]



https://msdn.microsoft.com/en-us/library/ms187061(v = sql.110)的.aspx [ ^ ]



http://stackoverflow.com/questions/5471080/how-to-schedule-a-job-for-sql-query-to-run-daily [ ^


Hello again you good people,

Back with another question. I have built a webform that will check the database for records with 'start time' less that 15 minutes from now, and another check on the same page for records with 'end time' less than 15 minutes from now. Then bind the data to separate gridview.

If row count for the gridview is greater than 0, the page sends email to admin.

The idea is to send a reminder email saying the booking will start in 15 minutes, and another one to say the booking will end in 15 minutes.

Question is, how do I get this page to automatically run every 15 minutes so that its always checking the db? I have it working, but it will need to automatically run every 15 minutes.

Thanks for you help.

解决方案

Scott Hanselman wrote a blog post[^] last year comparing the different options for scheduling background tasks in ASP.NET applications.


For a quick solution you could use the built in html way of doing it:

<head>
<meta http-equiv="refresh" content="15">
</meta></head>


http://www.w3schools.com/tags/att_meta_http_equiv.asp[^]

But as mentioned in a comment a scheduled task of some sort will be the best way to go.

On the database side of things you may want to look into SQL Server Agent.

These links may help:
https://msdn.microsoft.com/en-us/library/ms189237.aspx[^]

https://msdn.microsoft.com/en-us/library/ms187061(v=sql.110).aspx[^]

http://stackoverflow.com/questions/5471080/how-to-schedule-a-job-for-sql-query-to-run-daily[^]


这篇关于如何让页面自动运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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