views:

345

answers:

2

I am developing an application for Windows Mobile 6 using an emulator. When I try to open the database connection to the SDF file it is throwing an exception that it is not able to connect or find the file. My questions are:

  1. Where on the mobile device is the SDF file supposed to be deployed?
  2. Does the SDF file get automatically deployed to the emulator when I build the project (like in then windows forms app) or do I have to do that manually?

Any help would be appreciated.

+1  A: 
  1. The "where" is determined by you. You want it to be on the emulator, in its file system, at the location your connection string points to. Remeber that CE paths are always fully qualified.
  2. It depends. How is the SDF added to your project? If the SDF file itself in the project? If so, what is the "Build Action" set to (should be Content if you want it deployed)? What is "Copy to Output Directory" set to? It should be "Always" or "Copy if Newer" if you want it to be auto-deployed. If you use this mechanism for deployment, the file will end up in the same folder as your EXE (or if you have it in subfolder int he project it will be in a subfolder of the deployment directory).

You can also deploy the file manually using Remote File Viewer, by configuring the emulator to share a desktop folder or by "docking" the emulator using the emulator manager and using ActiveSync to copy the file over.

ctacke
Thanks for the quick response. I will check the file properties to make sure I have Content and Always.
Chad
A: 

// TODO : This Line Of Code For Indicating Path Name Where the Directory Information can be stored.

    string databaseconnection = ("Data Source=" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\\EBDataBase.sdf;Persist Security Info=False;");

SDF Name.. = EBDataBase

Its Automatically Gets the Connection String.....

Ashok