Here, it is said that Sql Server Compact allows up to 256 connections.
But when I try to open 2 connections, I receive a file sharing error. How can I solve this?
SqlCeConnection c1 = new SqlCeConnection('Data Source=testDB.sdf;Encrypt Database=True;Password=test;File Mode=shared read;Persist Security Info=False;'); SqlCeConnection c2 = new SqlCeConnection('Data Source=testDB.sdf;Encrypt Database=True;Password=test;File Mode=shared read;Persist Security Info=False;'); c1.Open(); c2.Open(); // throws SqlCeException c1.Close(); c2.Close();
There is a file sharing violation. A different process might be using the file. [ testDB.sdf ]
This was a connection string issue.
solved the problem.