-2

I am Developing Winform Application in C# with MS Sqlserver Compact Edition as Database. In Have trouble in multiple User access in this Application. Already i tried Sharing Concept in My Application but getting Error.

Following Error Occured:

There is a file sharing violation. A different process might be using the file.[\JAN-941C126E\Testing_GSm\Debug\New\GSM.sdf]

Any other solution?

Brinda
  • 1
  • Check http://stackoverflow.com/questions/1992713/sql-server-ce-in-a-multi-user-scenario-is-this-really-really-stupid – Aron Feb 18 '14 at 06:57

1 Answers1

0

Brinda,

Please make sure that the First connection to the database is not opened in an Exclusive mode. Refer below links on how to set the mode: http://msdn.microsoft.com/en-us/library/ms171817.aspx, http://msdn.microsoft.com/en-us/library/ms171763.aspx

Hope this helps.

Ankit
  • 672
  • 6
  • 18
  • Ankit Already I tried SqlCeConnection con = new SqlCeConnection("Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "\\New\\GSM.sdf;" + "Mode = Read Write"); but its also not working.. can u give some c# example coding for this – Brinda Feb 18 '14 at 07:08
  • Did you check the second link? – Ankit Feb 18 '14 at 07:23
  • S. i Did like this: SqlCeConnection con = new SqlCeConnection("Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "\\New\\GSM.sdf;" + "DBPROP_INIT_MODE = DB_MODE_SHARE_EXCLUSIVE;"); error occur :"The type initializer threw an exception." – Brinda Feb 18 '14 at 07:35
  • can u give some example code for that.... – Brinda Feb 18 '14 at 07:37