Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync

You Can Take it With You

Syndication

News

  • Don't miss the next Windows Mobile Webcast... Unit Testing for Mobile Devices: http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032382824&EventCategory=4&culture=en-US&CountryCode=US.
Thanks to everyone who attended the webcast this past week - we had another great turnout and some really great questions afterwards. Sorry for the delay in getting the apps we created during the webcast available for download. This past week was the end of the quarter which is always pretty crazy for me.
 
In any case, both the desktop and device app we created are available from here (both programs are in a single zip file ~100kb).
 
Note: Due to a limitation in the generated typed ResultSet in desktop projects, you'll need to change the path to the database file (RealEstate.sdf) in the source code file, RealEstateDataSet.Designer.cs, line 35. Change the path to point to the location where you've installed the project on your computer. See the first two comments below for more information.
 
Remember the steps we did…
 
On the device/emulator
  • We created a regular Windows Mobile 5.0 application
  • Added a SQL Server Everywhere database as a data source
  • Created a data bound grid from the data source
  • Let Visual Studio 2005 generated view and edit forms
 
On the desktop
  • We then created a desktop Windows Forms app
  • Added a SQL Server Everywhere database (same schema as device app) as a data source
  • Created a data bound grid from the data source
 
The test
  • We ran the device app
  • Modified an existing record
  • Added a new record
  • Saved the changes to the database
  • Used ActiveSync to connect the emulator to the desktop
  • Used Windows Explorer to navigate to the application folder on the device
  • Copied the SQL Server Everywhere database that the mobile app had modified
  • Navigated back to the desktop Windows Forms project folder see bug reminder below
  • Pasted the database
  • Ran the desktop Windows Forms app
 
And viola the desktop app was able to open and view the data fine including the new data from the device. We could then modify the same SQL Server Everywhere database file using the desktop app. If desired, we could've copied the database back to the device.
 
The key difference from something like Merge Replication or RDA which require that the desktop computer be running IIS & SQL Server, all we had to do was copy the file. Of course this solution is moving the whole database file where Merge Rep & RDA move individual records which is very powerful but there are many scenarios where it just isn't reasonable to expect a desktop user to have IIS & SQL Server installed and running all of the time.
 
Bug Remember: The one key "gotcha" we saw was that when you generate a typed ResultSet in a desktop application, the ResultSet opens the database located in the project folder rather down in bin\debug. One way around this is to use the generated constructor that accepts a connection string. Or you can use the extended typed ResultSet snippet I showed in last week's webcast (here's the downloads from that webcast)
 
Access/Jet Database Applications: If you have existing desktop applications that uses an Access (Jet) database, there's now a utility available that allows you to sync changes made to a SQL Server Everywhere database on a Windows Mobile device with the Access database. For the download URL and URLs to related resources, checkout this blog post
 

Posted Sep 30 2006, 06:12 PM by jim-wilson

Comments

Bob wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-03-2006 1:15 AM
When I open the form for App2 in design view I get the following error:
The path is not valid. Check the directory for the database. [ Path = G:\Shared Work\WebCast_General\27Sept06 SyncSqlEvDataActSync\DesktopDataApp2\DesktopDataApp2\RealEstate.sdf ]
Hide

at System.Data.SqlServerCe.SqlCeConnection.Open(Boolean silent)
at System.Data.SqlServerCe.SqlCeConnection.Open()
at DesktopDataApp2.RealEstateResultSets.propertyResultSet.Open()
at DesktopDataApp2.RealEstateResultSets.propertyResultSet..ctor()
Jim Wilson wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-03-2006 5:13 AM
Bob;

The problem is an artifact of VS not properly managing generated typed ResultSets in desktop projects. The generated typed ResultSet has stored the full path of the database file where it existed on my machine.

The thing to do is to open the file RealEstateDataSet.Designer.cs - go to line 35 which currently reads as follows:
resultSetConnectionString = "Data Source =\"G:\\Shared Work\\WebCast_General\\27Sept06 SyncSqlEvDataActSync\\Deskto" +
"pDataApp2\\DesktopDataApp2\\RealEstate.sdf\"";

Change the path to the RealEstate.sdf file to be the location of the project folder on your machine. VS will now be able to find the database file and all should be well.

I'm working on a more generic solution but due to the problem in the generated typed ResultSet where it doesn't properly differentiate between runtime & designtime, providing a good, clean generic solution with minimal code is a bit more complex.

I'll post the generic solution once I get it worked out cleanly.

Jim
Bob wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-05-2006 2:42 AM
I had already done that. I guess I should have included (This is just an FYI) in my comment.
Bob wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-05-2006 4:54 AM
When App2 is run there's a field (_sysP1) in the grid that causes it to crash.
Jonathan wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-18-2006 12:11 AM
Is it possible to download the webcast? I missed it and would love to see it. Thanks
Andre wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-21-2006 9:56 AM
When I run the desktop app I get an error concerning sqlceme30.dll (module not found). Does anybody know where I have to search for the error?
Jim Wilson wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-23-2006 12:12 PM
Jonathan;

Just an FYI: All of the Microsoft webcasts become available as on-demand webcasts the day after they are broadcast. The on-demand webcast is available from the same URL as the original live webcast.

The URL for this webcast is:
http://www.microsoft.com/events/EventDetails.aspx?CMTYSvcSource=MSCOMMedia&Params=%7eCMTYDataSvcParams%5e%7earg+Name%3d%22ID%22+Value%3d%221032308927%22%2f%5e%7earg+Name%3d%22ProviderID%22+Value%3d%22A6B43178-497C-4225-BA42-DF595171F04C%22%2f%5e%7earg+Name%3d%22lang%22+Value%3d%22en%22%2f%5e%7earg+Name%3d%22cr%22+Value%3d%22US%22%2f%5e%7esParams%5e%7e%2fsParams%5e%7e%2fCMTYDataSvcParams%5e
Jim Wilson wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 10-23-2006 12:25 PM
Andre;

Do you have SQL Server 2005 Everywhere Edition installed on your machine?

If not, you can get the CTP from here: http://www.microsoft.com/downloads/details.aspx?FamilyId=85E0C3CE-3FA1-453A-8CE9-AF6CA20946C3&displaylang=en

-Jim
Trushar Panchal wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 02-12-2007 2:23 AM
Hi Jim,

Excellent webcast. I wanted to know few things which is not entirely clear to me, still. If i have one database, TPDB0, created on SQL Compact Ed on the desktop, also i have TPDB0 database running on WM5 PDA, is there a way that TPDB0 database can be modified by both desktop application and PDA application and can we synchronise the database. In your webcast we saw that we created the database then we modified it on the PDA but we had to manually do copies so that the desktop app can see it. Is there an automatic way where if one app modifies the database the other is updated or the changes merged.

Thanks a lot.

Regards
Trushar
Marco Dal Pino wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 03-17-2007 3:41 AM
I try to view the webcast, but looking for it directly or with search I obtain this answer: "We're sorry, the event you are searching for no longer exists or has already passed.
Please confirm the date of your event, or search for a new event."

This webcast has been deleted?

regards
Marco
Raj wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 01-01-2008 2:44 AM
I have same issue of iccorect path Path = xxx.sdf, when using sql ce2.0 with vb.net 2005, pocekt pc.
I have tried all possible ways. Also as u mentioned above.
But in this method it generate a new error. "Unspecified unrecognized error".
Can u send me the code at sandlohana@hotmail.com
Jim Wilson wrote re: Webcast Downloads: Synchronizing Windows Mobile Data Using SQL Server 2005 Everywhere Edition and ActiveSync
on 01-02-2008 6:55 AM
Raj;

You can download the code directly from this blog post.

Just click on the "available from here" link in the post.

Jim

Add a Comment

(required)  
(optional)
(required)  
Remember Me?