Wednesday, September 12, 2012 2:12 AM
I have a WinForms application that I have placed on a test computer (copied the .sdf file and the executable from the release folder) running Windows 7 32bit. When I run the program I get this error message:
Could not load file or assembly 'System.Data.SqlServerCe, Version=188.8.131.52, Culture=neutral, PublicKeyToken=89845dcd8080cc01' or one of its dependencies. The system cannot find the file specified.
The test computer has both SQL Server 2005 Compact Edition and SQL Server Compact Edition 4.0 installed. The .sdf file and the executable are located in the Program Files folder. I've set the program to search for the database in this location:
string directoryPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "\\MedNote"); AppDomain.CurrentDomain.SetData("DataDirectory", directoryPath);
SqlCeConnection connection = new SqlCeConnection(@"Data Source=|DataDirectory|\keywordDB.sdf");
Since the error says that the file cannot be found I'm assuming that I'm calling the file incorrectly. Though, I'm not sure what I'm doing wrong. Could someone please guide me in the right direction?
-- Tyler Hughes
Wednesday, September 12, 2012 10:45 AMModeratorLook at my blog post on private deployment here: http://erikej.blogspot.dk/2012/05/private-deployment-of-sql-server.html
Please mark as answer, if this was it. Visit my SQL Server Compact blog
- Marked As Answer by Tyler Hughes Wednesday, September 12, 2012 12:12 PM
Wednesday, September 12, 2012 12:11 PMThanks ErikEJ. That worked perfectly!
-- Tyler Hughes