I have a call to SqlCeConnection.Open() that\'s failing. The exception message I\'m getting is pretty generic: \"System.Data.SqlserverCe.SqlCeException\" (more generic than pre
Since filename
contains the relative path "\My Documents\NRPSDB.SDF"
, your program may be looking for that path starting at the directory your application is running from, which is most likely the wrong place. Something like:
... \bin\debug\My Documents\NRPSDB.SDF
Try placing this in your method and see if it's able to find the file:
string conStr = string.Concat("Data Source = ",
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
"NRPSDB.SDF"));
If it is able to find it, then you'll have to use this wherever you're calling the method from, so that filename
contains the correct absolute path.
Regarding your update that you're using Win CE, the equivalent to SpecialFolder.MyDocuments
is SpecialFolder.Personal
.
From MSDN:
Personal. The directory that serves as a common repository for documents. This member is equivalent to MyDocuments.