Exclusive access using SqlCeConnection
Connection string
This .NET Compact Framework Data Provider for SQL Server Mobile connection string can be used for connections to SQL Server Compact.
Use this one to disallow other processes from opening or modifying the database while you have it open.
Data Source=MyData.sdf;File Mode=Exclusive;Persist Security Info=False;