4
Answers

Just showing updates to database tables

Rommel Raj

Rommel Raj

13y
1.8k
1
Simple question:

How can I display labelbox fields have been bound to SQL database table fields as they change?
The fields are changing from other programs. I just want to have a simple WPF program that displays the change.
Kind of like a status bar with like 2 labelboxes. I can do it with a clock using something like this:
 
private void Window_Loaded(object sender, RoutedEventArgs e)
{
        .....
        DispatcherTimer dispatcherTimer = new DispatcherTimer();
        dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
        dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
        dispatcherTimer.Start();
}

private void dispatcherTimer_Tick(object sender, EventArgs e)
{
        // TimeBox is my label field
        TimeBox.Content = DateTime.Now.ToLongTimeString();
}

How do I make the labels that are bound to a SQL table refresh itself when their data changes?

Thanks for any suggestions

- Rommel
Answers (4)