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