Is it possible to have a auto-tracking event or something similar to track the database when it changes?
For an example:

If the database gets a new insert value from another application that I currently have: then
My other application will notice it and fetch that data instead of getting the whole table each time.

Currently I have a loop that just gets the whole table each second. But I need to fetch the last change of the database. Is this possible or do I have to use a trigger in the database? Because I need to fix this without the use of a trigger.

(I only need the new change from the table, inserts, deletion & updates)


3 Years
Discussion Span
Last Post by shadyreal

You can use a class in C# called SqlDependency (it's part of ADO.NET). This uses the server's change notification service.

It's a bit cumbersome if you want to watch a lot of changes but it will do exactly what you want it to.

MSDN Link (SQL Dependency)


It seams to be what I need. But I can only bind it to a SQLCommand? I need to use Linq to SQL to get the data.

So how do I get the row(insert) that is changed only?
To get the changed data from the SQL only?


The only possible solution I've heard of is this one: LINQ to SQLCache

Otherwise, it's going to be a real pain to get it to work. It's possible, but you're going to have to do all the L2S manually behind the scenes (which negates the point of it)


I guess I have to rechange my projekt then. Because Im out, Im totally out now. Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.