using Sync Service on Windows Mobile 5.0 apps
Hi I am developing an application on windows mobile 5.0 environment and using VS 2005 for the same.
I thought of making use Microsoft ADO.Net synchronization services for sync funcionality.
I am trying to make use of the same code as available in OfflineAppDemo-TSQL+SProc but trying to convert it to Windows Mobile 5.0 project.
But soem code are so specific to desktop environment that it wouldn't work on Win Mobile:
DbServerSyncProvider serverSyncProvider =newDbServerSyncProvider();SyncAgent syncAgent =newSyncAgent();syncAgent.ServerSyncProvider = serverSyncProvider;
//System.Data.SqlClient.SqlConnection//SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();////Data Source=SRINSOFT;Initial Catalog=GreyhoundDB;User ID=sa//////// 2. Prepare server db connection and attach it to the sync agent//////builder["Data Source"] = @"RAJESH\SQLEXPRESS";//builder["integrated Security"] = true;//builder["Initial Catalog"] = "ClientInfo";//builder["User ID"] = "sa";//builder["Password"] = "";SqlConnection serverConnection =newSqlConnection(" Data Source=srinsoft\\SQLEXPRESS;Initial Catalog=ClientInfo;Integrated Security=True");//System.Data.SqlServerCe.SqlCeConnection serverConnection = newI SqlCeConnection("");serverSyncProvider.Connection = serverConnection;
Like in the above sample, the SQLConnectionBuilder wont work.
The last line which I have highlighted in bold gives an erroe:
Cannot implicitly convert type 'System.Data.SqlClient.SqlConnection' to 'System.Data.IDbConnection' D:\TestProjects\WinMobile5.0Projects\SamplePrj1\TestSampleApp\TestSampleApp\ClientList.cs 106 49 TestSampleApp
Is it not possible to use the DBSyncProvider and the SyncAgent classes on WindowsMobile project.
I do get similar errors with the command object when trying to execute queries
Error 7 Cannot implicitly convert type 'System.Data.SqlClient.SqlCommand' to 'System.Data.IDbCommand' D:\TestProjects\WinMobile5.0Projects\SamplePrj1\TestSampleApp\TestSampleApp\ClientList.cs 199 72 TestSampleApp
Can you pls help me out with this asap.
Hi there,
- The current CTP is not for devices (basically, it does not work against .net compact framework). The plan is to ship devices-ready version at a later stage.
- The future support for devices won't enable direct connection to server database scenrio still, you will need to use Web Services, WFC, or any custom transport to talk to the server. The Microsoft.Synchronization.Data.Server.dll won't run on devices.
Thanks!
Hi Rafik.
Thanks a lot for your inputs.
I was under the impression that ADO.Net sync would be the best bet for me to make use of sync funcionality for windows mobile apps.
But it would really be good to have it working on devices. So any idea as to when the device ready version would be available.
When you say direct connection wouldn't be available, does it mean that I would have to maintain a webservice/wcf which can do the server sync process like in your webservice demo and then can have the Microsoft.Synchronization.Data.Client.dll running on the device for client level sync.
Pls do clear me if I am wrong.
Rafik, any other way I can achieve sync between a windows mobile 5.0 pocket pc app and a DB server.
Pls do let me know I am to start this project asap and I am kind of stuck with the syn part of it.
Hi,
I don't know that release date for the devices version since it is not final yet. Work in progress though and you should expect to hear more concrete plans soon.
Yes, you are right. The devices support won't have the Server DLL which means you will need to access the server side through webservice or WCF.
The current solutions for sync data to PPC are:
1- RDA (Remote Data Access)
2- SQL Server Merge Replication
Thanks
Hi Rafik
Thanks for the same, I hope it should be available atleast by end June/July this year, cause, I really dont want to move on with sql merge replication or RDA, because of the setup process it has to go through, it makes it so much difficult for one to deploy it over a clients location.
Any other idea you can think of by which I can achieve this. even if there is a third party soltuon which I can lookout for it would be ok.