Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

You will need a to update the underlying datasource everytime the table changes.
Have a look at event based processing[^].
 
Share this answer
 
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
 
Share this answer
 
Comments
Amir Mahfoozi 10-Dec-11 1:12am    
I think saving the changes and notifying all clients of the happened changes, are two distinct problems.
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.
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900