473,473 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Transfer dataset from server to client and keep in sync

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
--
Anthony Malt
Jan 3 '06 #1
2 2805
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

Jan 4 '06 #2
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

--
Anthony Malt
"Peter Kelcey" <Pe**********@telus.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
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

Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason Gyetko | last post by:
I have a software application with an Access front end and an Access backend to house the data. Recently I converted the backend to MySQL. The Access frontend works fine connecting to the MySQL...
6
by: Lester Moreno | last post by:
Hello all, Up to now C# have been an great experience but I found myself in a end of the road problem. Let say that you have two windows program running on a local network area. User1 and...
11
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to...
5
by: Karl | last post by:
Hi C# experts, I am to C# and .NET. I am writing a database application using C# and Dataset. In Sql server, I have a Acount table which contains over 100,000 records. This table will be...
5
by: BobAchgill | last post by:
Can you point me to a simple example of how to transfer a file (send or receive) using a webservice. Thanks! Bob PS. Pardon my double posting. I also posted to the webservices forum.
11
by: E.T. Grey | last post by:
Hi, I have an interesting problem. I have a (LARGE) set of historical data that I want to keep on a central server, as several separate files. I want a client process to be able to request the...
10
by: David | last post by:
I have googled to no avail on getting specifically what I'm looking for. I have found plenty of full blown apps that implement some type of file transfer but what I'm specifcally looking for is an...
2
yashg
by: yashg | last post by:
I am building a data backup application in C# using Sockets. It has a server component and a client component. The client is going to upload files to the server through TCP sockets. I've got all...
0
by: =?Utf-8?B?R3V5?= | last post by:
I already spent some time thinking for a solution for my problem, but finally can't decide what would be the most optimal and correct solution. Therefore I post my question to this forum, to get...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.