datagrid视图自动刷新,关闭表单 [英] datagrid view auto refresh with out close the form

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

问题描述

亲爱的朋友

我只有一个包含datagridview的表单;

I have just one form containing datagridview ;

我需要这个datagridview实时读取表中的数据  ;

I need this datagridview read the data from table in real time 

当插入或删除的任何新记录只是自动出现在此网格中而不关闭表格并重新打开表格

when any new record inserted or deleted just appear in this grid automatically with out close the form and reopen the form

推荐答案

您好,

以下链接在C#中,如果使用VB.NET将是一个简单的转换一个C#到VB.NET的语言翻译器。

The following links are in C# and if using VB.NET will be an easy conversion with a C# to VB.NET language translator.

如果使用SQL-Server以外的任何东西,你需要实现代码来检测计时器滴答事件中的变化。 

If using anything other than SQL-Server you need to implement code to detect changes in perhaps a timer tick event. 

使用SQL-Server,您可以使用类检测更改
SqlDependency
但要预先警告有安全要求/设置才能使其工作。请参阅

以下是限制
。 

Using SQL-Server you can detect changes with the class SqlDependency but be forewarned there is security requirements/setup to make this work. See the following for limitations

另请参阅  https://www.codeproject.com/Articles/12335/Using-SqlDependency-for-data-change-events

See also https://www.codeproject.com/Articles/12335/Using-SqlDependency-for-data-change-events





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

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