Click here to Skip to main content
13,053,276 members (61,313 online)
Rate this:
Please Sign up or sign in to vote.
Hello all,

So I have the following dataflow :
SQL SERVER Table A > C# Observable collection > XAML Binding

I know that obsverable collection implements already PropertyChange so the
C# Observable collection > XAML Binding part is not an issue.

My question is : Is it possible to update the collection when I change a value in the sql table ?
Posted 9-Dec-11 6:20am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You will need a to update the underlying datasource everytime the table changes.
Have a look at event based processing[^].
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

So I dug into the question, but even if this solution propose interesting features, it doesn't suit my needs.
It's more like a monitoring method that I need.
In here, every change in the table will trigger the event base processing and send me a notification once. But say I have multiple instance of a programs taht connects to this database, if one instance updates the table, then it won't be catch by the other instances.

I ll keep you posted if I find an answer, thanks though
Amir Mahfoozi 10-Dec-11 1:12am
I think saving the changes and notifying all clients of the happened changes, are two distinct problems.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Ok, after more research I found out that there is something called SqlDependency that was implemented since SQL server 2005.
Very interesting function that enables the SQL Server to "push notifications" to the subscriber. (where here the subscriber is my C# program)

So now whenever the table in SQL change or is modified then it triggers a function in my C# program.

Pretty Cool :)

Thanks Abhinav for the hint. It helped me finding that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 12 Dec 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100