0

I have created an application which will fetch data from a .sdf file and display it to user. It works normally for the first user, if the second user tries to use it it is throwing an exception that file is being used by another process.

I have tried fixing the issue but I am not able to do so.

Instead I have tried with .MDF file and have placed it over the network path, here even the first user is not able to connect to it.

It is saying that network won't allow databases.

Note: No issue with connection string.

What is the best way of sharing the database to users over the network, so that users can access it simultaneously.

Which database to use and how to achieve it.and how to connect to .MDF or .SDF files located on the network.

AstroCB
  • 12,337
  • 20
  • 57
  • 73
DARA SANDY
  • 19
  • 2
  • 7
    The **best way** is to put your data into a **SQL Server database ON A SERVER** - stop fiddling around with files and sharing them on a network - use a **centralized server machine** where your database resides, and then all PC's connected to that network can easily and without any messy issue read and write their data. `.sdf` is SQL Server Compact Edition, and that's definitely **only** intended as a single-user, local database - it's **NOT** made to be shared on a network! – marc_s Feb 24 '15 at 15:01
  • 1
    Network share **can be used** as inefficient database. You can have some file containing data stored and open it exclusively each time when accessing it (sort of synchronization). Then there is [FileSystemWatcher](http://stackoverflow.com/q/151804/1997232) to tell you if something has changed to re-read data from it. But `mdf` if probably the worst format you could chose for such scenario. SQL server (via which you access it) needs some time to open it and it keeps it opened (locked) unless you detach database. – Sinatr Feb 24 '15 at 15:25

0 Answers0