Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Delphi (http://www.programmingforums.org/forum41.html)
-   -   program doesn't work on different pc (http://www.programmingforums.org/showthread.php?t=2274)

ramson Feb 15th, 2005 1:59 PM

program doesn't work on different pc
 
I come here with the hope of finding an expert who wouldn't mind helping out a newbie
I put a simple application together that uses one file (I've used MS Access and Excel)as its database.It works fine on the pc
it was compiled on but not on other ones.I need to have the database included in the program folder and have the program
know the path of the "new" database and not the "old" one.The problem in VB was resolved by adding:

[b]Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\xxxx.mdb"
End Sub


under form create and it worked. But when I was advised to do this in delphi :

Var
DBFileName: String;
Begin
DBFileName := ExtractFilePath(ParamStr(0)) + 'DatabaseName.mdb';

I did the same thing here and put these lines under FormCreate and changed the "DatabaseName" to my filename,
but that didn't work. Are those two procedures supposed to achieve the same thing?
If they are then I am doing something wrong .. could anyone help me out here and give me a step by step explanation
how I would achieve..I have spent hours upon hours searching the Internet trying to get this done.

Any help would be appreciated.

Ooble Feb 16th, 2005 8:07 AM

You've stored the path in hte string DBFileName - then what do you do with it?

ramson Feb 16th, 2005 9:53 AM

This is where I am lost and I need help at a beginner's level. I was advised to:
// Then set the database connection string appropriately
// so that it points to the database file.
// Then set all your table or query components active
I thought I did that when I used the DataSource and ADODataset and I am able to see the tables in the *.mdb file when I run the program on the delphi machine but when I put it on a floppy it keeps looking for the file at the original location. So how do I make the program use this DBFilename as the path to the file?

Ooble Feb 16th, 2005 10:05 AM

Unfortunately, I can't remember, and I won't be able to check until I get back to school next week - that's where all my Delphi apps are. I believe it's one of the properties of the ADOConnection though.

ramson Feb 16th, 2005 10:59 AM

I'll check the properites on the ADOConnection and see what I can come up with. I 'll
definitely post the solution if I find it ..if not though I hope you'll let me know when you get back to school
Thanks again for your help

Ooble Feb 16th, 2005 11:29 AM

I will do, if you don't figure it out beforehand. Sorry 'bout that.

ramson Feb 16th, 2005 11:37 AM

Problem Solved !!
It's just like you said Ooble...the problem was setting the connection
property for ADODataSet .. before, I used to locate the file showing the whole path..this time I deleted the path and left just the file name and VOILA.!!

Thanks a lot again for the help..I know where to come for help next time and what site to recommend.

Ramson

Ooble Feb 16th, 2005 5:40 PM

Sounds good. Unfortunately, I'm the only guy here (apart from Rory) who knows any Delphi, mainly because it's a crap language. My suggestion is to drop it as soon as you can and move onto C++, C# or Java.

ramson Feb 16th, 2005 9:03 PM

I am just starting out dabbling with programming and have tried VB as mentioned in the first message. Is Java easier to work with? Any advice on where to start?

Ooble Feb 17th, 2005 12:05 PM

They're not easier to work with, but if you ever decide to look for a job in programming, that's where the money is.


All times are GMT -5. The time now is 2:22 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC