Buffer_z Buffer_z - 1 month ago 9
SQL Question

c# Noticing Table Changes

I was wondering what's the easy way to notice if a change has occured to a

DataTable
.
Basically I have a timer that in its
TicK Event
Return a
DataTable
from
SQL Server


My Methods :

private void GetInfo(Timer T)
{
T.Interval = 2000;
T.Start();
T.Tick += T_Tick;
}


private void T_Tick(object sender, EventArgs e)
{
GetInfo();
}


My
Getinfo()
Display the datable returned in a
DataGridView


What's the easiest or the cleanest way to Refresh the gridview only if a change has occured on a row or even on a single cell ?

Because it keeps refreshing the
DataGridview
even when no changes occured I don't want to Refresh it if no changes has occured!

Change : means any new
INSERT
or
UPDATE
or
DELETE
Query Effected on the Table

EDIT :
like if i m getting a new datatable from database (Modified than the actual one) how can i compare between them and if there are some changes or some differents display the new one in the datagridview

Answer

Solved By comparing between tables if no differences noticed between the two DataTables , but if there is then the new datatable will be set as the source of the datatable

Comments