Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
445 views
in Technique[技术] by (71.8m points)

c# - How do I share a SQL Server CE database file (.sdf) for multiple processes?

I have a database in SQL Server CE. When connecting several applications of different computers to the database throw an exception.

This is the exception:

There is a file sharing violation. A different process might be using the file. type of exception is "SqlCeException".

and this is my connection string :

Data Source=\serverProductionDBProductionControl.sdf;File Mode=Read Write; Max Database Size = 4000

The version of SQL Server CE is 3.5 SP2

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I misread your question initially, but I don't believe SQL Server CE supports multiple connections from different computers.

From an MS guide:

When you require data service functionality, such as the ability to support multiple, remote users, you should start with SQL Server Express Edition and work up the data service family tree.

You can have multiple connections (up to 256) from the same machine, but connections from multiple machines requires SQL Express Edition. It's freely available and easy to deploy.

Here's the link: http://www.microsoft.com/sqlserver/en/us/editions/express.aspx


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...