Database path


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Database path

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Database path

    [Originally posted by Tim Stutzman]

    In my VB app I have the database path hard coded.’ But what if the user wants to move it to a different location?’ How can I set it up so the user can change where the app is looking for the database without haveing to change code?

    Thanks
    Tim

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Database path

    [Originally posted by Muhammad Zahid Rafiq]

    The best way of this to make a DSN and then no probelm where the data base is reside.
    If user change the path then he need to only set that path in DSN and it is working fine.

    any probelm let me know back
    Zahid M Rafiq
    Zahidraf@hotmail.com

  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Database path

    [Originally posted by m.posseth]

    hmmm dsn ???

    i don`t like them at all i just use a standard connection string with a database path variable that is set at runtime ,,,


    hope this helps

    happy coding :-)

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Database path

    [Originally posted by Kevin]

    DSNs are Ok but, you may find it easier to just read an ini file in the app path.’ After installing the program on each user's machine, you run a setup routine from your program's Tools menu.’ Through the use of the Common Dialog, you user browses to the location of the data.’ You can use this same technique to set printers and other user preferences as well.’ It is simple and effective and far less complicated than using the registry.’ Send me an Email and I'll send you an example.

  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Database path

    [Originally posted by m.posseth]

    yes but requires user interaction ,,,

    i make several projects ,where i even’ give the user the ability to let the database on the cd-rom during setup ,,,

    however it could be possible that the user later makes a complete install , or asigns another drive letter to his cd-rom , or even better copies the data to a shared network drive ,,,

    to make a solution for all of the above seems complicated ,, but is acomplished during runtime whitout any user interaction ( except if it detects no data at all wich should mean that the d-rom was forgotten , or the network is down _)

    i do this by building my connection string during runtime , just give the database a uncommen name and search for it if you won`t find it in the expected place. This is proofed technology’ works for over 30.000 of my users all across europe :-)


    and about DSN`s it maybe, just a mather’ of taste but i don`t see any use for them

  6. #6
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Database path

    [Originally posted by Andon K.]

    IMHO, DSNs are good only when there is no native OLE DB provider for the database, so the only possibility is to use the ODBC provider.

    Otherwise, a much better way is to setup connection strings at runtime by reading them from a file (I use .INI files), or from the registry or a database, when more security is needed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center