I have a datagrid that displays a table which is bound to a sql server DB.
I would like to set a Timer for every 60 sec, that checks for any updation and then displays the latest updated data.
So far I have created a event_handler for datagrid, that includes the object dispatchertimer
private void dataGrid1_loaded(object sender, RoutedEventArgs e)
DispatcherTimer dispatcherTimer = new DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 60);
Now I don't know how to proceed further with the event handler to handle the newly updated data from the database.
here is my select statement that is used to fill the datagrid.
private void Page_Loaded(object sender, RoutedEventArgs e)
String selectstatement = "select top 2 ItemID, ItemName,ConsumerName, Street, DOJ from ConsumarTB order by ItemID ";
da = new SqlDataAdapter(selectstatement, con);
ds = new DataSet();
dataGrid1.ItemsSource = ds.Tables.DefaultView;
catch (SqlException e)
Kindly help, even if there is another approach.