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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a portable database app Delphi 1

Status
Not open for further replies.

l19bal

Programmer
Jan 1, 2011
2
GB
Hello all, I have created a database app which is for booking appointments, and the database contains customer information. My problem is that I can't open the application on any other computer apart from mine as I get an error saying the database couldn't be found, and that folder is on my PC, the one I originally made the app from. I've done a lot of googling and searching but can't seem to find anything that will instruct me with some code that will look for the database within the same folder of the applications exe file. I want the app to be portable so that I can run it off say for example a memory stick and switch between computers if I need to. Sorry if I haven't made any sense but if you like I can provide more details. any help would be greatly appreciated! And please bare in mind that I am sort of new to programming in delphi; started over a year ago and can understand a fair amount of things, I think! Thanks again.
 
Your best answer is to have an embedded database, and Delphi happens to ship with one (depending on the Delphi version you have). Have a look at these two links that explains how to set up a TClientDataSet. A clientdataset can be used for multiple purposes, but one of its uses is as a file based database. You can set up the location of the file - I wouldn't put the db in the same folder as the program due to vista/win7 user access issues. Create a special folder in My Documents.



To programmatically get the path to special windows folders (like My Documents) look here:

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top