Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27375

VS 2010 Refreshing bound Datagridview automatically without timer

$
0
0
Hi,

My database is in MySQL. I have installed XAMPP Server with phpmyadmin version 4.5.1 on an i5 machine. It is a simple db with two tables and each tables having five columns. Records count may not cross 5000.

Users from web may update the data in the underlying table (MySQL) through PHP.

I am developing a desktop application in VB.NET connecting to this MySQL using mySQLConnector class.

The idea is to fetch the data in a VB.NET application route it to further processing the data.

Code:

  Private sub GetData()
        Dim BS As New BindingSource() ' BS is a public variable
        DATA = New DataTable
        DA = New MySqlDataAdapter("SELECT * FROM " + tables.SelectedItem.ToString(), CONN)
        CB = New MySqlCommandBuilder(DA)
        DA.Fill(DATA)
        BS.DataSource = DATA
        dataGrid.DataSource = BS
  End sub

I get the latest data only when I call this function. I want the datagridview always display the current data of the underlying table automatically. I do not want use 'Timer' for calling this function repeatedly.

Is there any method which triggers an event when an underlying table undergoes any change by any method?

Thanks for understanding, hope i am clear in my question.

Regards,

Viewing all articles
Browse latest Browse all 27375

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>