Wednesday, October 8, 2008

Preparing a JetDatabase

This is a brief guideline on how to prepare an Access database to become the synchronization source for "Desktop Sync". In order to follow these indications, you must have the latest version of the Sync project (here).
  1. Create a JetDatabase object with the appropriate properties.
  2. Open the database and call LoadSchema to load the collection of tables and columns into memory.
  3. If you want to synchronize the whole database, call TagSchema with the TagSchemaOption.All value as parameter.
  4. If you just want to synchronize a subset of the database, make sure you manually tag the tables and columns (set the UserInt value to: 0-exclude, 1-synchronize, 2-export only).
  5. Initialize a PrepareProgressCallback delegate and make it point to a method for progress reporting purposes.
  6. Call the Prepare method using the progress reporting callback. You can call this method from a thread or from a background worker.
  7. Done.
The database is now prepared and you can close the JetDatabase object. The schema selection information is persisted on the database so is is readily available when creating synchronization clients.

To remove the tracking tables and columns, use the Unprepare method.

0 comments: