简体   繁体   English

从数据库检索数据

[英]Retrieve data from database

I need to use C# to get data from database(sql) and the data in database is updated every few seconds. 我需要使用C#从database(sql)获取数据,并且数据库中的数据每隔几秒钟更新一次。 So do I have to make a loop or there is a better way to do that? 那么,我是否必须做一个循环,或者有更好的方法呢? Is it possible that when database is updating, the program can wait until it finishes updating? 数据库更新时,程序是否可以等到更新完成? thx! 谢谢!

Take a look at Query notifications in ADO.Net. 看一下ADO.Net中的查询通知 These allow your code to be notified by SQL Server whenever the results of a particular query change. 这些使您可以在特定查询的结果发生更改时由SQL Server通知您的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM