Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / January 2006

Tip: Looking for answers? Try searching our database.

Transfer dataset from server to client and keep in sync

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anthony Malt - 03 Jan 2006 08:13 GMT
Hi,

my server has a database table. I read this table on the server into a
dataset and my client retrieves it through a webservice.

No changes on the client and server happen. What's the best way to keep the
data in sync?

I want to avoid that I transfer the entire dataset all the time. Is there a
way just to send/receive the changes?

Thanks for any hint

Anthony
Signature

Anthony Malt

Peter Kelcey - 04 Jan 2006 04:48 GMT
Anthony

One thing you can look at is the getchanges method of your dataset. You
can use it to perform the following steps

1) Retrieve the dataset from the server
2) The client modifies the dataset
3) The client submits only the changed rows
4) The server merges the changed rows into its dataset
5) The server accepts the new changes on the dataset

Here is some sample code that would do this.

//retrieve the dataset from your service
Dim dsClientSide As DataSet = YourWebService.GetData()

//Modify the ds
ModifyDataSetContents(dsMain)

//Send back the changes
Dim dsModifiedRows As DataSet = dsClientSide.GetChanges()
objWebService.SubmitChanges(dsModifiedRows)

//Back in the service, merge the recieved changes back into the
server's own copy of the ds
dsServerSide.Merge(dsChanges)
dsServerSide.AcceptChanges()

Note, in order for the merge method to work, your dataset needs to have
a PrimaryKey property set.

Hope that helps

Peter Kelcey
Anthony Malt - 05 Jan 2006 16:04 GMT
Hi Peter,

thanks for your answer. Actually I need the other way around. The client
does not modify the dataset. I would like just to subscribe to the changes,
which come from the server.

So the client stores the cache (store dataset as xml) and is disconnected
for long time. I would like to load the cache on the client and just
received the changes from the server.

Any thought?

Thanks in advance
Anthony

Signature

Anthony Malt

> Anthony
>
[quoted text clipped - 30 lines]
>
> Peter Kelcey

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.