How to make the data in the DataTable automatically change when there is the Insert, Update or Delete.
my code like this:
VB.NET Code:
Imports System.Data Imports System.Data.OleDb Public Class frmSupplier Dim dt As New DataTable Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.WindowState = FormWindowState.Maximized End Sub Sub setData() Try Dim sql As String = "select vendor_id,vendor_name,address,phone from inv_t_vendors order by vendor_id" dt = ggDB.SelectRecordToDT(dbConn, sql) dg.DataSource = dt Catch ex As Exception ERRDesc(ex) End Try End Sub Private Sub cmdRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRefresh.Click setData() End Sub Private Sub tFilter_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tFilter.TextChanged ' filter data End Sub Function AddData() 'load form entry ' refresh data End Function Sub ModifyData() 'load form entry ' refresh data End Sub Sub DELETEData() ' delete data ' refresh data End Sub End Class
I want the data in a DataTable is changed according to the data on the actual database.
whether I should call my method setData() at AddData, ModifyData & DeleteData for getting the data at this time.
thank you


Reply With Quote
