Re: Help With Basic Windows Mobile App



FlyFishGuy,

There is no such thing as a current directory in CE, so the first one would reference the root - not what you want. There is no c: on CE either so the last one won't work either. If your app folder is Program Files\MilkMonitor, I'd expect "Data Source=Program Files\MilkMonitor\MilkMonitor.sdf" to work. Or use this:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\MilkMonitor.sdf" to find the file in the same folder as the app, wherever that might be.

--

Ginny Caughey
Device Application Development MVP


"FlyFishGuy" <FlyFishGuy@xxxxxxxxxxxxx> wrote in message news:%23bmcaM5YJHA.4072@xxxxxxxxxxxxxxxxxxxxxxx
That's what I can't seem to get right. I've tried many variations, each with and without a space between 'Data' and 'Source', also with single and double slashes. Here are just a few of them...

Private Const DB_CONNECTION_STRING As String = "Data Source=MilkMonitor.sdf"
Private Const DB_CONNECTION_STRING As String = "Data Source=|DataDirectory|\MilkMonitor.sdf"
Private Const DB_CONNECTION_STRING As String = "Data Source=My Device\Program Files\MilkMonitor\MilkMonitor.sdf"
Private Const DB_CONNECTION_STRING As String = "Data Source=Mobile Device\Program Files\MilkMonitor\\MilkMonitor.sdf"
Private Const DB_CONNECTION_STRING As String = "Data Source=c:\Program Files\MilkMonitor\MilkMonitor.sdf"

Also, I've since inspected the app directory on the emulator. The sdf file is there in the app folder, so I know it got deployed, but the application just doesn't see it, even if I execute the deployed app directly from the emulator and not in VS debug mode. Given that the sdf is in the app folder, I would expect that the first one listed here would work.

The error message (using example #1) is... The database file cannot be found. Check the path to the database. [ Data Source = MilkMonitor.sdf ]

BTW... example #2 is what I've always used for a CE desktop (winforms) application, with no issues.

Thanks

"Pete Vickers" <pete@xxxxxxxxxxxxxxxxxxx> wrote in message news:4460F074-182B-4047-897A-BCA067894216@xxxxxxxxxxxxxxxx
What is your connection string?

"FlyFishGuy" <FlyFishGuy@xxxxxxxxxxxxx> wrote in message news:OueInWsYJHA.5156@xxxxxxxxxxxxxxxxxxxxxxx
This is my first attempt to create a simple mobile app, with db access, but I'm having issues and I can't seem to find any (accurate) info on the problems.

I'm using, VS2008 SP1, SQL CE 3.5, WinMobile Pro SDK 6.0, ActiveSync 4.5.

First, my app will only run using the 'Classic' emulator. I have MANY goofy exceptions when trying to use the 'Professional' emulator. I know that's not an SQL CE issue, but I thought I'd throw it in also in case someone else has seen the same issue.

Regarding SQL CE, I have yet to connect to my DB. I always get the 'the path is not valid' error using the emulator. The sdf file is set to Build Action=Content and the Copy To Output Dir= Copy Always. I've seen many suggestions for this error like using double backslashes in the path, puttimg 'Mobile Device' in the path, using '|DataDirectory|', etc. I've tried everything I have read, but no connection. I've also read where I should be manually copying the sdf file, but how? The emulator does not show up in the 'Mobile Devices' on the PC. I'm lost.

My first thought is that if something so simple is so difficult to figure out and there is no (findable useable) documentation on this then I should wait until the technology matures to the point that it works out-of-the-box, but I would like to get this working if anyone can provide some clarity on this.

Thanks





.



Relevant Pages

  • Re: Help With Basic Windows Mobile App
    ... I'm appreciative of your help and I don't like scope creep, but I'm having issues with my 6.0 Pro Emulator. ... "\MilkMonitor.sdf" to find the file in the same folder as the app, ... Private Const DB_CONNECTION_STRING As String = "Data ... The sdf file is there in the app folder, so I know it got deployed, but the application just doesn't see it, even if I execute the deployed app directly from the emulator and not in VS debug mode. ...
    (microsoft.public.sqlserver.ce)
  • Re: Help With Basic Windows Mobile App
    ... If your app folder is Program ... I've since inspected the app directory on the emulator. ... read where I should be manually copying the sdf file, ...
    (microsoft.public.sqlserver.ce)
  • Re: Help With Basic Windows Mobile App
    ... I've since inspected the app directory on the emulator. ... The sdf file is set to Build ... puttimg 'Mobile Device' in the path, using '|DataDirectory|', etc. I've ...
    (microsoft.public.sqlserver.ce)
  • Re: June 2005 EAL Question
    ... parameter to a string. ... > public class MyEventLogInstaller: Installer ... You have a web app, ... >>> at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean ...
    (microsoft.public.dotnet.general)
  • Re: Running other applications
    ... associated with a file type (extension). ... file and calling FindExecutable: ... ByVal lpDirectory As String, ByVal lpResult As String) As Long ... > The app is a program called Data Junction. ...
    (microsoft.public.vb.general.discussion)

Loading