Click here to Skip to main content
15,741,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello !!
I am using below statement to connect with database and already include MyDB.sdf file in Application folder of my windows installer.

SqlCeConnection con = new SqlCeConnection("Data Source="+ System.IO.Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "MyDB.sdf"));

After build My .exe when i run it using shortcut on desktop, 
application working is stopped. why?

Thank you

1 solution

Share this answer
anandd.mohit 2-Dec-14 5:19am    
now i use this
SqlCeConnection con = new SqlCeConnection(@"Data Source=|DataDirectory|\MyDB.sdf");
same problem exists again.
Mehdi Gholam 2-Dec-14 5:22am    
Try adding logging to your application to see what the errors/exceptions are.
anandd.mohit 2-Dec-14 5:30am    
internal error: Cannot open shared memory region.
Mehdi Gholam 2-Dec-14 5:34am    
Read :
anandd.mohit 2-Dec-14 5:34am    
Hey if run it as Admin the problem is solved. its working now
but i don't know why?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900