自动刷新datagride视图 [英] automatic refresh datagride view

查看:96
本文介绍了自动刷新datagride视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想自动刷新我的数据网格.
这意味着当我向数据库中添加用户时,网格将显示该信息.

我该怎么办?

请帮帮我.

Hi All,

I want to refresh my datagrid automatically.
This means that when I add a user to my database, the grid shows that.

What can I do?

Please help me.

Thanks in Advance.

推荐答案

如果您的应用程序不是Web应用程序(似乎不是),则可以编写在SQL触发器中运行的C#代码,并且从那里向您的应用发送消息.另一个选择是,当用户被其他人添加时,创建事件而不是监听数据库.也就是说,假设他们可以通过LAN或Web相互通信.您需要更好地定义问题以获得更好的答案.
If your app is not a web app, which it seems not to be, you can write C# code that runs inside a SQL trigger, and send a message to your app from there. The other option is, instead of listening on the DB, creating an event when a user is added by someone else. That is, assuming they can communicate to each other via the LAN or the web. You need to define your problem better to get a better answer.


我不确定您是否真的要这样做,但请允许我警告您在datagridview上进行自动刷新可能会导致性能问题,尤其是在处理大数据和多个用户时.但是,如果您真的想解决这个问题,则可以使用 Timer Control [^ ].只需设置间隔(以毫秒为单位),然后在Timer.Tick事件上,放置用于刷新datagridview的代码.
I''m not sure if you really want to do this, but let me warn you that doing an autorefresh on your datagridview might cause performance issues, especially when you are dealing with large data and multiple users. But incase you really want to push through this, you can probably use a Timer Control[^]. Just set the interval(in milliseconds) and on the Timer.Tick event, put the code for refreshing the datagridview.


使用带有间隔的Timer Control,因为这会在datagridview中造成问题会造成性能问题.
Use Timer Control with the interval, because it creates problem in the datagridview will create performance issues.


这篇关于自动刷新datagride视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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