Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to specify the database path dynamically? 1

Status
Not open for further replies.

sanjna000

Programmer
Aug 1, 2003
132
GB
Hi,
i've got 6 tables in a database and currently i have specified the path by using tablename.DatabaseName property. But the problem is whenever the time i change the location of my database i have to change the database path in my code.This is so inconvenient for me. Can any one help me to solve this problem please?

Many Thanks for u r help in advance,
Sanjna...
 
I've had that problem before. There are two solutions i thought of 1) read the database path from the registry 2) create a simple .txt file with the path and read from that in your app. I use the 2nd solution.
 
Hi rrrrrrichie,

Can u let me know the way where u can read the database path from the registry ? I need a good way of doing this since i have to distribute my database along with my tool to the client. What is the best way of doing this. I am waiting for u r reply..........

Many Thanks,
Sanjna...
 
Ummmmmmmm, the reason i went down the path of a txt file was that i knew how to do that!! If you are using an installation tool such as InstallShield then you can use that to add the database path to the registry upon installation. Then you could just read from the registry when your program starts. Using a quick google i found this:


Any good to ya?
 
hi

Personally, I would recommend using an .ini file rather than the registry as it's a lot easier to maintain when the databasename changes. It also doesn't start configuring the users' machines and the users are able to run the app from anywhere(other PCs). Overall, I just think it's an easier and cleaner way and doesn't leave entries in registries when the app is no longer used. Other people may disagree with me, though.


Is there a reason why you want to use the registry rather than an .ini file?

lou




 
Hi rrrrrrichie And Anna,
Thank you so much for both of u r guys help. Since i am new to Delphi i didn't have any idea of doing it. Many Thanks for all the help u 'll given to me. I will try it in both ways and would let u know if i need any more help......

Thanks again,
Sanjna...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top