Note that there are some explanatory texts on larger screens.

plurals
  1. POLive data on datagrid for newly added or deleted row in database
    primarykey
    data
    text
    <pre><code> public void RefreshEntities(object sender) { for (; ; ) { try { //refreshing entities will not add new rows added so datagrid needs to be recreated if (isChanged()) { Fetch(); //Reset binding or reconstruct data grid networkEntityTracker = pLCSignilinxEntities.SIGNILINX_NETWORK.ToList().Count; systemEntityTracker = pLCSignilinxEntities.SIGNILINX_SYSTEM.ToList().Count; tagEntityTracker = pLCSignilinxEntities.SIGNILINX_TAG.ToList().Count; } pLCSignilinxEntities.Refresh(System.Data.Objects.RefreshMode.StoreWins, pLCSignilinxEntities.SIGNILINX_NETWORK); pLCSignilinxEntities.Refresh(System.Data.Objects.RefreshMode.StoreWins, pLCSignilinxEntities.SIGNILINX_SYSTEM); pLCSignilinxEntities.Refresh(System.Data.Objects.RefreshMode.StoreWins, pLCSignilinxEntities.SIGNILINX_TAG); } catch (Exception ex) { MessageBox.Show("Unable to refresh."); } Thread.Sleep(300); } } </code></pre> <p>I have a datagrid dragged from Data Sources. The datagrid corresponds to a table of an entity data model created from SQL database. The table in the database changes regularly. So the goal of my program is to show live data on the datagrid. And my program is working very well displaying live data except for new or deleted rows. When a new row is inserted into the table in SQL database or a row is delete is deleted, the datagrid does not update that row.</p> <p>The above function is the function that refreshes the data grid. I think I have to write the Fetch() function to reset binding or reconstruct data grid in order to update the data grid for newly added row or deleted row.</p> <p>Then this function is called by background thread as delegate so that the data grid is refreshed every 300 ms.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload