Get correct data from DB after updating it?

SX1

New member
Joined
Jan 5, 2007
Messages
1
Programming Experience
1-3
Hi,I made a datagrid to view the contents of a table in my DataBase.However, when I update the contents of the table and I return to display the datagrid, I see the old data, I don't see the updated data! I want to display the updated data in my datagrid.Could you help me please to solve my problem?What should I do? Refresh the datagrid? How?Thanks
 
How are you updating the contents of the table? By table do you mean the table in the database or a table in the dataset?
If you are updating the table in the database and the datagrid is bound to an in memory datatable then yes you will have to requery the database for the new data, or add the same data to the dataTable that you added to the database table.

It seems a lot of people miss the fact that ADO.NET uses a disconnected architecture. This means that when you query a database, the results are stored in memory. The data is modified then the changes are sent back to the database.
 
Hi,I made a datagrid to view the contents of a table in my DataBase.However, when I update the contents of the table and I return to display the datagrid, I see the old data, I don't see the updated data! I want to display the updated data in my datagrid.Could you help me please to solve my problem?What should I do? Refresh the datagrid? How?Thanks


So, you show the table contents in a grid, (downloading the table into the client) and you want, for example, when another user updates the table, for the changes to come through?

You need to use special sql server extensions for this, so that updates of rows cause events to fire for connected/known clients.. its a long process..
 
Back
Top