轮询数据库以获取来自C#应用程序的更新 [英] Polling database for updates from C# application

查看:190
本文介绍了轮询数据库以获取来自C#应用程序的更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建我的第一个真实" C#应用程序-一个小型宠物项目,以帮助安排工作中的同行评审.

I'm attempting to create my first "real" C# application - a small pet project to help schedule peer reviews at work.

由于实施新事物需要耗费大量的流程/官僚主义-以及我暂时不在管理层的视线范围内进行此操作-我将要由于限制了我可以将此应用程序部署到同事的方式,因此使用 MS Access MS Jet Engine后端(即访问mdb文件)编写此代码.

Due to the insane amount of process/bureaucracy involved in implementing anything new - as well as the fact that I'm doing this away from managements eyes, on my own time, for the time being - I'm going to be writing this with an MS Access MS Jet Engine backend (i.e. an access mdb file) due to restrictions on how I can deploy this application to my co-workers.

我的问题是:如何间歇地轮询数据库以从数据库中获取更新(新请求的评论,来自其他开发人员的信息,等等)?

My question is: how do I poll the database intermittently to grab updates (new requested reviews, messages from other developers requesting info, etc.) from the database?

我是否应该在需要信息的每个表单上放置一个计时器,并在发生更新时刷新所有内容?

Should I just drop a Timer on each form that needs the info and refresh everything when an update has occurred?

修改:
我正在寻找有关如何实现计时器的建议.我无法在工作站上安装东西,无法访问服务器(存储空间之外),并且由于公司的安全性要求,我自己也无法托管此主机,因为我们的客户端具有可笑的DoD限制.


I'm looking for advice specifically on how to implement the timer. I can't install things on workstations, I don't have access to servers (outside of storage space), and I can't host this myself due to the company's security requirements since our client has ridiculous DoD restrictions.

我想我还是想通了,因为表单计时器"解决方案可以正常工作(我说我想要CLI版本的辅助解决方案时我不知道我在想什么.不需要..已经很晚了.

I guess I've figured this out anyway, since the "timer on form" solution works just fine (I don't know what I was thinking when I said I wanted a secondary solution for a CLI version as it clearly isn't needed.. it's very late).

谢谢!

推荐答案

您可以启动后台工作线程以无限循环进行刷新,并在每次循环迭代的末尾(或开始)休眠.

You could start a background worker thread to do the refreshes in an infinite loop, and sleep at the end (or beginning) of each loop iteration.

这篇关于轮询数据库以获取来自C#应用程序的更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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