views:

42

answers:

1

Hi, The problem that i'm having is how can i synchronise my datasets in my VS 2008 project to any changes in the database.

As you know we read data from the db into the dataset which is disconnected, now lets say 1 minute later something updates the data in the database. What i want to do is after a set time interval check the db for any updates, i have a column already in my tables in the db that show when that row was last updated and so check this column and return all rows that are greater then the time of my last retrieval into my dataset.

Now the actual issue is what can I do to implement this structure? I was thinking of having some sort of loop that ran every so often which would get my new dataset with only the rows that have been updated but then how do i add those rows to my existing dataset where the existing dataset will replace any rows that are the same with the row from the new data and add any rows that aren't in existing one but are in the new one.

I did look at Sync Framework from Microsoft and the Local Cache but from what i can tell it only works on tables as i am hooking into a Stored Proc, unless i am wrong?

PS. I am coding in C#.

Can anyone help?

A: 

datatable.merge

Steven A. Lowe
Excellent i just googled that and it does seem to do what i want.Would you happen to know of any other way to keep the data syncedbesides the way i am approaching it perhaps?Thanks
Iffy
@[Irfan Ikram]: I do not, except for SQL Server change-notification, which i've never used; see http://stackoverflow.com/questions/877273/change-notification-with-sql-server-2008
Steven A. Lowe
Thanks. I'll do that then.:)
Iffy