Little Bugsy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pruljnij
    New Member
    • Apr 2007
    • 7

    #1

    Little Bugsy

    Hi i have been getting and getting this interesting bug every time ,and i dony find any solution to solve it :P

    i have database bind like this :

    objConnection = New OleDbConnection ( _
    "Provider=Micro soft.Jet.OLEDB. 4.0;" & _
    "Data Source=..\..\kl ienti.mdb;")

    after that i have function print file dialog or save file dialog ,
    where i can choose the directory to write data or print ,but
    after this function is over i have been getting this thread

    Could not find file 'C:\Documents and Settings\klient i.mdb'.

    i think this migth be problem in system stream engine or system.io
    somewere its keeping data about my dialog and reset data about where database is stored , but its have one thing i cant bind it directly on my disk.
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Don't forget, the "..\.." is a relative path, so will start from wherever you are at the time. This might be why the file is not found.

    Comment

    • pruljnij
      New Member
      • Apr 2007
      • 7

      #3
      how to reset to its default state ?
      or how to bind a directory where to be ?

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by pruljnij
        how to reset to its default state ?
        or how to bind a directory where to be ?
        Not entirely certain I understand the question, but if you specify a complete path (that is, starting from drive or root folder) rather than a relative one, then it will continue pointing to the same place, even if you change your current folder.

        For example, if you are in "C:\Temp\Di r1" then the partial path ".." refers to "C:\Temp". If you then move up one level, ".." will refer to "C:\" root directory. But a complete path such as "C:\Temp\Di r1" always means the same place. (Well, usually).

        You might want to go to the Windows help and support stuff, and study up on how paths work. It's important.

        Comment

        • pruljnij
          New Member
          • Apr 2007
          • 7

          #5
          Ive solved that by strongly binded my database on to directory :)
          like
          objConnection = New OleDbConnection (My.Settings.kl ientiConnection String)
          settings :
          Provider=Micros oft.Jet.OLEDB.4 .0;Data Source="C:\Prog ram Files\Steklopak et\klienti.mdb" ;Persist Security Info=True;Jet OLEDB:Database Password=****** *
          i have been done this thru my settings because you samples of the tip of the week dont working properly throwing the error sometsing like
          cant open database be sure its none of network use or been opened in exclusive mode :P

          Comment

          • Denburt
            Recognized Expert Top Contributor
            • Mar 2007
            • 1356

            #6
            Originally posted by pruljnij
            how to reset to its default state ?
            or how to bind a directory where to be ?
            Although rare but if your app and DB are in the same directory...

            MsgBox "The current directory is " & CurDir

            This also may be a case of the default directory changing on you although I am not 100% that this is your issue it sounds like it could be, which the following would help resolve..

            FileSystem.ChDi r Method

            Glad you got it working though and I know hard coding things can be such a pain.

            Comment

            Working...