views:

250

answers:

1

Im having a moment of stupidness.

I have a Treeview control in WPF, that is displaying a list of Quotes, ie Quote#, Quote Name eg "Q#1000" "Server Quote" This treeview is bound to a collection of objects

public ObservableCollection quoteitems = new ObservableCollection();

Which are loaded from a SQL database via an SQLDataReader which populates the collection. Chnages to the Quotes Collection are commited to SQL after calling a QuoteUpdate() method that writes the changes to the colection back to the database.

The problem is, what happens if a another user using the same app chnages the Name of a Quote. How can I detect a change to the table, WITHOUT polling the table for updates? or using a timmer to refreash the data in the TreeView.

Am I missing something in binding controls to SQL?? is there a way to bind a control to a table and have updates handled by the control automatically??? I see "two way data binding" and that seems to be what im after but havent seen a way to do this with an SQL data source. Or am I having a dumb moment with how Im thinking about the way SQL actually works!?!?

A: 

If you're using SQL Server (version 2005 and above), you can use Query Notifications to monitor changes. Have a look at this article to get a headstart on this.

Pete OHanlon