Sql Compact randomly produces AccessViolationException
Just because you set a connection to command.Connection does not mean it is set.
command.Connection = connection;
command.Connection.GetHashCode() == connection.GetHashCode(); // may return false.
This is the cause of the problem. Can be corrected by using connection.CreateCommand();
SQL CE objects are not thread-safe. Also, the same article lists a version mismatch situation (which happened in my case).