在更新Access数据库后更新DGV [英] update DGV after updating Access Database

查看:94
本文介绍了在更新Access数据库后更新DGV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Access数据库,该数据库每40秒更新一次,我想将所有更新的数据传输到DGV.但是我在更新DGV时遇到问题.第一次没有问题,但是40秒后,DGV将不会更新.如果有人可以帮助我,将不胜感激.

I have an Access Database that is updated every 40 seconds and I want to transfer all updated data to DGV. But I have a problem updating the DGV. The first time there is no problem, but after 40 seconds, the DGV will not update. It will be appreciated if anyone can help me.

推荐答案

添加一个计时器并将时间间隔设置为40000.在您的主窗体中的某个位置
启动计时器.添加一个子例程,如下所示.
Add a timer and set interval to 40000. Somewhere in your Main Form
start the timer. Add a Subroutine as shown below.
Private Sub refreshTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Me.Tabel1TableAdapter.Update(Me.Db1DataSet.Tabel1)
        Me.Tabel1TableAdapter.Fill(Me.Db1DataSet.Tabel1)
        Me.DataGridView1.DataSource = Me.Db1DataSet.Tabel1
        Me.DataGridView1.Refresh()

End Sub


这篇关于在更新Access数据库后更新DGV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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