A learning experience with SQL Server CE

Yesterday I encountered two things while working with SQL Server Everywhere (yes, I know it has been rebranded, but I was working with the CTP which still has the SQL/e branding).  The first thing was that apparently you can’t create a SQL Server CE database (in code) on a storage card in the emulator.  Ok, so this sucks for a number of reasons, the obvious one is how do you debug your application if you don’t have a real device and your database is larger that the available memory in the emulator (or you just want to test that your application works with saving data to the storage card)?

The next thing was a case of Microsoft errors that drive us insane or make us laugh: “A read operation from the Internet returned an invalid number of bytes”.  Well no kidding, its not like you can do:

Dim iReader as new InternetReader(ReadOptions.TheLot)
While iRead.Read
    …… Process the internet
End While

Who ever came up with that error message either thought that it would never get called or had a very limited imagination.  For anyone who has worked with Merge Replication or SQL Server CE you will completely understand the world of pain that is associated with debugging errors that frequently arise for no particular reason.  The documentation is by far the worst I have ever seen from a Microsoft product and despite the best efforts to improve it, still provides little or no guidance around fixing replication related issues.  What I would like to see is a well documented list of all the possible errors/exceptions that can be emitted, complete with a list of what causes those errors and the resolution options.  Clearly attaching a debugger at a client site is not an option.

Leave a comment