Click here to Skip to main content
15,885,985 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
Posted

1 solution

 
Share this answer
 
Comments
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    
exception:
internal error: Cannot open shared memory region.
Mehdi Gholam 2-Dec-14 5:34am    
Read :
http://support.microsoft.com/kb/2718718
and
http://stackoverflow.com/questions/2571847/sql-server-ce-internal-error-cannot-open-the-shared-memory-region
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