You can connect to the two databases with SqlCeConnections, then use the GetSchema
command to retrieve data about table/column structure. Then you will need to walk through the contents of the tables and make sure all the fields match.
Have you considered using some sort of versioning in your databases with a compatibility list? For instance, have a table Version
with a single column/row of the version number in your database, say VersonNumber
. Then your application knows that, say, version 1.05 - 1.09 are all compatible with each other, but 1.10 is not, etc. If that Version
table is missing completely (or contains an invalid version number), then you automatically know it is not a valid .sdf file for your application.