如果Sql Compact允许多个连接,为什么我会收到文件共享错误? [英] Why do I receive file share error if Sql Compact allows multiple connections?
本文介绍了如果Sql Compact允许多个连接,为什么我会收到文件共享错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里,据说Sql Server Compact允许最多256连接。
Here, it is said that Sql Server Compact allows up to 256 connections.
但是当我尝试打开2个连接时,我收到一个文件共享错误。如何解决这个问题?
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();
存在文件共享冲突。不同的进程可能正在使用该文件。 [testDB.sdf]
There is a file sharing violation. A different process might be using the file. [ testDB.sdf ]
推荐答案
这是一个连接字符串问题。
This was a connection string issue.
File Mode=Read Write
问题。
这篇关于如果Sql Compact允许多个连接,为什么我会收到文件共享错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文