Results 1 to 3 of 3

Thread: Data Path from INI file at run time

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Littlehampton, W Sussex GB
    Posts
    203

    Post

    I am creating a system which reads an ACCESS database and processes data on several different forms, using various types of data control (Adodc1, Data1 etc.)
    How can I set the Connection srting(s) at design time to look at the IniFile settings "Datapath", so I can distribute the app and have it dynamically point to the correct database?
    Help please as I'm going crazy trying to figure this out!

  2. #2
    Lively Member
    Join Date
    Jun 1999
    Location
    Raleigh, NC
    Posts
    70

    Post

    First off... you probably don't want to use an INI file. If the file gets damaged or lost, your program just doesn't work. Why not have the database install in the directory with the application, so you can use App.Path? Then it won't matter where the user installs your app, as long as they install it all together.

    As far as setting data paths at runtime, just make sure you do not set any data paths for your data controls at design time. They should all be blank. This will prevent your from 'forgetting' to set one of them, or some of the related properties for bound controls. Many times I've tested thoroughly, only to find things blowing up once the application was installed on a new machine because a data path was still looking for a file in a location that only existed on my hard drive.

    Set the databasename property of the data control and then refresh the connection.

    Bash

  3. #3
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    I would disagree about using a .ini file. They're very small and if you have any kind of source control, very easy to recover. If one gets corrupted (or deleted) it's very easy (and quick) to pop one in the mail.

    When using bound controls, I agree with you. I only set the database name long enough to retrieve fields and then I *always* reset it to blank.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width