locked
SQL sdf not copying to emulator RRS feed

  • Question

  • I'm running VS 2008 and have my windows mobile project all set up. I can run just fine and do simple stuff but i created a db - mps.sdf and have the settings for the db as build action = content copy to output = copy always. I have the connection string set up correctly as shown below. The sdf is not copying to the emulator. I even went through and use the emulators query analyzer and can find no sdf on the phone. I get an error: The database file cannot be found. Check the path to the database. [ Data Source = \Program Files\MPS_SmartPhone\mps.sdf ]
    I looked for it as well in the phone emulator and it's not there. I see the exe for mps_SmartPhone.exe but no sdf??? Why is it not copying the db over to the emulator?
    I feel like I'm loosing my mind bc this should not be so hard? What is the deal? Can anyone plllleeeeaassseee help me before my computer meets an untimely end through my window?

     

    Me._connection.ConnectionString = ("Data Source =" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase) + "\mps.sdf;"))

     


    apotterosa
    Friday, December 4, 2009 8:53 PM

All replies

  • The "Build Action" and "Copy to Output Directory" settings should be OK. Also getting the folder path from executing assembly seems to be OK.
    What is maybe wrong is using "\" character instead of "\\" or "@". In other words the problem is maybe with "\mps.sdf". It should be either "\\mps.sdf" or @"\mps.sdf".

    I've heard that the problem with copying the SDF file occurs when it's included in a Library project but I've never tried it.
    Saturday, December 5, 2009 9:15 AM