none
Data changed notification? RRS feed

  • Question

  • i have got this function returning data from a database to a treelist.datasource.

    public
    List<Table> GetAllTables()
    {
        var tables = from table in db.Tables
        orderby table.table_name
        select table;
        return tables.ToList();
    }

    ...

    treelist.datasource = GetAllTables();

    But I would like the treelist to get updated automaticley when data was changed in the database.

    How do I do that?

    Monday, August 24, 2009 6:45 PM

All replies

  • Look into using ObservableCollection<T> Class to see if it works for you.
    William Wegerson (www.OmegaCoder.Com)
    Monday, August 24, 2009 7:10 PM
    Moderator
  • If you are wanting data to be updated if the data on the server changes, independent of your application, you will need to monitor the database server's events or have your own objects poll the server.
    Monday, August 24, 2009 7:33 PM
  • Hi Michael,

    How you got an exampel on how to monitor the database server's events?
    And maby an exampel on how to make an object that polls the server for changes?

    Best regards, Morten
    Tuesday, August 25, 2009 7:03 AM

  • http://msdn.microsoft.com/en-us/library/bb522489.aspx

    http://msdn.microsoft.com/en-us/library/ms190378.aspx

    http://dotnetslackers.com/Community/blogs/bmdayal/archive/2009/04/24/sql-server-2008-auditing-change-data-capture-and-tracking.aspx

    You can also build your own objects that track certain tables.
    • Proposed as answer by JohnGrove Tuesday, September 1, 2009 12:53 PM
    Tuesday, August 25, 2009 1:29 PM
  • Hi Michael,

    I don't think that I can use the links that you provided.
    They seam to monitor changes to the sql server.

    What I want is to retrive data from the database. But if the data that I have retrived from the database gets change I would want to get notified.

    Maby it is easyer to create a object that execute the linq query each 10-20 second.
    Thursday, August 27, 2009 6:50 PM