Using SQL Server CE in Windows Service
I am trying to use SQL Server CE in windows service on Windows 2008.
Whenever I try to open connection to SQL Server CE database I get an error
Database File not found
I am amazed because the database file is present there no issue with that part... any ideas?
SQL Server Compact encountered problems when opening the database.
[ Internal Error Number = 25039, Internal Error String = Access to the database file is not allowed. [,,,File na开发者_如何学Cme,,] ]
I had the same problem and in my case it was the location on the connection string.
I was putting only the database as data Source, like:
Data Source=Panoptes.sdf;
And I chenged for:
Data Source=|DataDirectory|\Panoptes.sdf;
After that it started to work normally
精彩评论