简体   繁体   中英

Multi threading in SQL Server CE

I have developed a WPF application a unit of work and repository pattern. I am using SQL Server CE 3.5 SP2. My application works fine when using on single thread. But when I am using it on server, user connects through Remote Desktop Connection, and it becomes multi-threaded application which creates problems.

My database is in Environment.SpecialFolder.CommonApplicationData .

When two users simultaneously fire any transaction with database I am getting following errors:

Internal error: Cannot open the shared memory region.

and

Database already opened by a different user.

What is the best way to avoid this situation? Or if situation can not be avoided then what can be the best way to handle this exceptions..

As @marc_s has commented, you really should try to use at least SQL Server Express or even a higher version to enable multiple concurrent users to successfully access the database from your application simultaneously.

There is a similar question that was asked in the SQL Server CE in a multi user scenario - is this really, really stupid? post and that post has a good answer with more details that you should take a look at.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM