Wednesday, February 3, 2016

sql mobile and sql server 2000 merge replication problems




            


There are the following requirements:

Pocket PC installed on the client have sql mobile, users patient data entry (new or modified data) on the pocket pc, each line of data entry, you need to save in the local sql mobile database, and also upload to the remote sql server database 2000. Taking into account the capacity constraints of the Pocket PC, when at the end of a patient, the patient information will be deleted on the pocket pc.
Now consider two scenarios: RDA and replication
.Because there are a lot of data upload with RDA feel unsafe, but programming is also very troublesome. The basic way it rejected the RDA.
With replication approach, encounter the following problems: on the pocket pc want to keep patient information current, but if you call sychonize () method, the system should download other patient information to pocket PC (or server side will delete other patients Information? not tried), so consider using host_name () to dynamic filter data, which set host_name () is PatientID, only the synchronization information relating to the PatientID. But because PatientID is dynamic, so I do not know you can not implement this feature?
I look forward to us, very grateful.

Reply:
In addition, because there may be many clients, so only the definition of a publisher, the client synchronization (VS.Net 2005 code) with the following code:
public void ReplicateData ()
{
try
{
string datasource = "Data Source = '" + GetCurrentDir () + "\\ test.sdf'; Encrypt = False";
SqlCeReplication replicator = new SqlCeReplication ();
replicator.InternetUrl = "http://192.168.0.10/test/sqlcesa30.dll";
replicator.Publisher = "% PublisherName%";
replicator.PublisherLogin = "% PublisherLogin%";
replicator.PublisherPassword = "% PublisherPassword%";
replicator.PublisherDatabase = "test";
replicator.PublisherSecurityMode = SecurityType.DBAuthentication;
replicator.Publication = "FirstRepublication";
replicator.Subscriber = Dns.GetHostName ();
replicator.SubscriberConnectionString = datasource;
//replicator.AddSubscription(AddOption.ExistingDatabase);
replicator.Synchronize ();
}
catch (Exception e)
{
MessageBox.Show (e.Message);
return;
}
MessageBox.Show ("Successful");
}

Reply:
If the data is small, not as the direct use of Web Service to synchronize.

No comments:

Post a Comment