3

In a WPF application, I have an ObservableCollection that is populated and updated by a stored procedure call to SQL Server(querying a table). Then, the UI objects are updated using values from this ObservableCollection.

How can I implement this to be automatic in that the stored procedure will be called when a new row is added to the underlying database table in SQL Server? Then, the ObservableCollection would be updated and the datagrid will display the current records.

Maybe a separate thread running for every certain time? But I really only need to run it when there is an insert on the table.

my779
  • 59
  • 6
  • I recommend that you look into Entity Framework. – Ryan Searle Dec 02 '15 at 15:06
  • I'm using entity framework, could you be more specific? – my779 Dec 02 '15 at 15:07
  • Oh sorry, I miss read the question, you want to change value in program when SQL DB value changes – Ryan Searle Dec 02 '15 at 15:09
  • i want the datagrid to display the most current records, so whenever a new row is added to the underlying database table, I want the ObservableCollection to be updated – my779 Dec 02 '15 at 15:11
  • I believe the only reasonable way of doing this would be using a timer. http://stackoverflow.com/questions/4409558/c-sharp-timer-run-every-5th-minute – Ryan Searle Dec 02 '15 at 15:11

0 Answers0