Losing AppPath

Discussion in 'Questions (Windows Mobile)' started by dennishea, Mar 25, 2008.

  1. dennishea

    dennishea Active Member Licensed User

    On my ppc my program fires up and runs fine until I start up another program. It looks like the other app resets the apppath and when I go back to my program it doesn't see the database anymore. The only way to get it going again is to shut down my program and restart it and all is well again. My question is can I use something other than apppath to tell my program where to find the database?


    This is what I'm using now.

    con.New1
    con.Open("Data Source = " & AppPath & "\MyData1.sl3")
    cmd.New1("",con.Value)
    cmd.ExecuteNonQuery

    My program, dll's, and data file are all on my storage card in a folder.

    Thanks in addvance for the help. :sign0085:

    P.s. Or point me in the right direction. Thank You
     
  2. agraham

    agraham Expert Licensed User

    I don't think it can. I believe that the AppPath is read when an app starts and is stored internally as a string thereafter so I don't think that anything external could alter that.

    Are we talking about any other program or just a particular one. Are any errors produced and if so which one(s)? Is the database maintained open during this time or does it fail on opening after this other program is started?

    More info about exactly what is happening is needed I'm afraid!
     
  3. dennishea

    dennishea Active Member Licensed User

    Are we talking about any other program or just a particular one. Are any errors produced and if so which one(s)? Is the database maintained open during this time or does it fail on opening after this other program is started?


    Hi agraham.

    1)
    Normally any windows programs.
    2)
    It says sqlite error No such table: workdata or :cams depending on which table I'm opening at that moment.
    3)
    As long as my program isn't shut down yes it is still open. I don't do con.close until the program is closed.
    4)
    I have two tables I add to and subtract from. I use this type of code to read the data base .

    cmbCam.Clear
    reader.New1
    cmd.CommandText = "Select Internal FROM Cams ORDER BY Internal"
    Reader.Value = cmd.ExecuteReader
    Do While reader.ReadNextRow = True
    cmbCam.Add(reader.GetValue(0))
    Loop
    Reader.Close

    They normally fail after the other program(s) have been run. At that point a simple restart allows it read again. If any of my statements aren't politically correct like my spelling, forgive me. I'm hoping to learn from the people in this forum and I am a slow learner.



    edit: I'm not sure what's going on I just tried to duplicate what I stated above and now it won't do it. It has been doing it right along for the last week or so. I have been trying to shrink my code the last two or three days and it problably was something wrong with my code and I inadverently corrected it. Time will tell.
     
    Last edited: Mar 25, 2008
  4. Erel

    Erel Administrator Staff Member Licensed User

    I don't believe that AppPath changes.
    You can easily check it with a simple Msgbox(AppPath).
     
Loading...