"Kuldeep" <ku****************@hotmail.comwrote in message
news:Os**************@TK2MSFTNGP06.phx.gbl...
Framework: Visual Studio 2005, ASP.NET
Programing Language: C#.NET
I am using a Generic List Collection to fetch a particular master data
from the database. Once collected, I use this Collection to bind it to a
DataGrid.
Now that I am using a Generic List Collection to populate the DataGrid,
say another user would insert a new record on to the same master data from
a different machine, the updated data (along with the lastest inserted
record) would not be available in the Generic List Collection!
How do I control this?
Your List is indeed a snapshot of the database at the time that you
performed the query, so you won't see the changes that other users make to
the database after you took your snapshot. If you want to see those changes,
you will need to requery the database and load the new data into the List.
You could do that by repeatedly polling the database, but if the server is
Sql Server 2005, there is a better way: You can create a SqlDependency
object, and be notified in the OnChange event of the changes to the
database.
http://msdn2.microsoft.com/en-us/lib...ependency.aspx