Sunday, March 8, 2009

The database is not initialized

I was having an irregular issue when working with a SqlCeReplication object in .Net, that i was often getting the error "The database is not initialized". My synchronization methodology was that the 'synchronize' method was called periodically to sync the client with the server. The problem turned out to be when the client would click on my synchroninzation window, which would tell the user when the last synchronization occured, and what changes made. I got this information from the 'LoadProperties' method in the SqlCeReplication object. The issue, apparently, is that if a synchronization is going on while i call LoadProperties, then i get the error.

Since the SqlCeReplication object does not tell you it's progress, that the object is synchronizing or cancelling or whatever, i needed to create a wrapper around the object to do it myself. Once i did this, the problem was gone.

The lack of some sort of 'status' indicator for the SqlCeReplication object is probably one of the biggest problems i see with using it, but there are ways around that.

Labels: ,