How can i solve this mobile application development problem?
While connecting to the DB
dataSource = \\..datafile.sdf
I get this error
"Path not found"
I am using serviceCE dll for data access.
How can i solve this mobile application development problem?
While connecting to the DB
dataSource = \\..datafile.sdf
I get this error
"Path not found"
I am using serviceCE dll for data access.
"\.." doesn't make sense. It indicates your data is one level above the root folder, which doesn't exist. Besides, ctacke informs me in the comments that CE doesn't support relative paths anyway.
If relative paths were supported in your OS, the rest of my answer still applies. I'll leave it for future reference (and probably, since a lot of people seem to downvote without reading the entire post first) some loss of reputation. :-)
If the datafile is one level above the folder your app is in, the correct path would be '..\datafile.sdf'; in some programming languages you have to escape the backslash, so it would become '..\datafile.sdf'
Where is your data actually located, and where is your app? If the app is in \yourapp\folder\bin, and your data is in \yourapp\folder\data, the path from the app to the data would be '..\data\'. If the data file is in \yourapp\folder, the path would be '..\'. Again, you'll probably have to double the backslashes to escape them depending on the language you're using.
Windows CE has no concept of a relative path, so even if you "fixed" your invalid relative pathing it wouldn't work. You must use absolute paths.
The path you you have typed it is a relative path. Windows CE/Mobile does not support relative paths.
It follows that since there is no concept of a current directory on a Windows Mobile device how would one locate a resource for which only a relative path is known? A .Net program always has access to the modules of which it is composed (usually a .Net component is composed of one module packaged in a DLL or EXE file). The following line will return the absolute path to the currently executing assembly.
string modulePath = this.GetType().Assembly.GetModules()[0].FullyQualifiedName;
with a little more code you can get the directory in which your program is running
Path.GetDirectoryName(this.GetType().Assembly.GetModules()[0].FullyQualifiedName)
Using that information you can build a proper path string to your resource.
note: If you are developing using the native APIS use the following: GetModuleFileName(GetModuleHandle(NULL), pszFullPath, MAX_PATH);