If you’re using the Visual Studio 2008 (SP1) Data Source Wizard or Local Data Cache wizard and you get a message like this:
Synchronizing the database failed with the message:
'Unable to initialize the client database, because the schema for table ...[list of tables]... could not be retrieved by the Getschema() method of DvServerSyncProvider.
Be sure to check the compatibility level of the targeted database to make sure it’s set to SQL Server 100 (2008). This should have been tested before the database was listed as supporting automatic sync support, but in any case, the exception message should show the reason for the error, not the cause.
To set a database’s compatibility level, open SQL Server Management Studio, open the database and choose Properties | Options. Use the drop-down to choose the right compatibility level. Of course, this assumes that the database is closed elsewhere (like in the Visual Studio Server Explorer). Once you change compatibility level, the engine rechecks the schema etc. to make sure there aren’t any compatibility issues.
Also, make sure you try to compile your project with x86 or x64 explicitly. I’ve discovered some disconnects with the default <AnyCPU> configuration setting. You can ignore the warnings when using x64 that complain that mscorlib.dll, system.data.dll and system.transcations.dll target a different processor. This is a known bug.
In some cases you might have to get the Local Data Cache wizard to rebuild the .SDF cache database to properly sync with the server-side table(s). Simply open the LocalDataCache.sync and make a property change and set it back once the sync has completed.
hth
