Locked Refreshing LINQ datacontext

  • Thursday, December 03, 2009 2:16 PM
     
     
    Hi All,

    I am facing one problem here.

    I have following methods in DataContext class

    sp_GetCountries -  Returns list of Country class
    sp_GetCounrty - Returns the object of Country class
    sp_UpdateCountries - Accept the object of Country as parameter

    Client first calls method sp_GetCountries method and assign results to grid. Then when user double clicks the particular record on the grid then client calls sp_GetCounrty method and receives the object of country class. After doing some changes client calls sp_UpdateCountries and pass the object of Country class as a parameter. After this I am calling refresh method of DataContext class as follow

    DataContext.Refresh(Data.Linq.RefreshMode.OverwriteCurrentValues, DataContext.Countries)

    And then calling sp_GetCountries method again and assign results to the grid but grid is still showing the old values. When I actually doubleclick the grid again then i am receiving the Object of Country class with updated values.

    Since I am new to LINQ to SQL, can somebody help me to resolve this issue?

    Regards,
    Prabi


    I can be still better.

All Replies

  • Saturday, May 15, 2010 5:45 AM
     
     
    I believe you can call the .Refresh method of the DataGrid in order to redraw the grid with the current values.  Although, I often just reset the .DataSource property of the BindingSource (or the DataGridView if there is no BindingSource in use).
    Brent Spaulding | Access MVP
  • Tuesday, October 05, 2010 4:03 AM
     
     

    Not able to verify at the moment, but as I recall, setting as I have described will force a refresh of the DataGridView.


    Brent Spaulding | Access MVP