Board index » delphi » which table am I using ?

which table am I using ?

The same program is OK or fails depending on the machine is running on. When
the path of a table is not specified, in one case the program defaults to a
directory where that table exists, in anothe case where it doesn't exist and
it fails. I tried to find out which is the table the program is using in one
case or the other, but I didn't find a function for this, nor I found out
why in one machine the program defaults to the directory of the exe and not
in the other machine.
Can anyone help ?
 

Re:which table am I using ?


Quote
Franco Jommi (franco.jom...@tin.it) wrote:

: The same program is OK or fails depending on the machine is running on. When
: the path of a table is not specified, in one case the program defaults to a
: directory where that table exists, in anothe case where it doesn't exist and
: it fails. I tried to find out which is the table the program is using in one
: case or the other, but I didn't find a function for this, nor I found out
: why in one machine the program defaults to the directory of the exe and not
: in the other machine.

Using what database engine?

If the BDE, my advice is:
1) For large applications, or applications that may grow and
expand, use alias names.

2) For small applications, using a single table or not much more,
consider putting the table in the same directory with the .exe
file.  Then, in the form's onCreate method:
var s: string;
begin
  s := ExtractFilePath(Application.ExeName);
  Table1.DatabaseName := s;
  Table1.Open; //when compiling, Table1.Active should be False
end;
--
Rick Carter
carte...@email.uc.edu   Rick.Car...@ParadoxCommunity.com
Chair,   Paradox/Delphi SIG,   Cincinnati PC Users Group

Re:which table am I using ?


Thanks for your advice. I am using the DBE and my program uses an ini file
to remember the path to the archives and the problem occurs when, for any
reason, the ini file get lost. But I wanted to understand how Delphi behaves
in the case I open a Table but no path has been explicitally defined.
 What is the default path in this case ? Is there a function that I could
use in the program to understand which directory is accessed when opening
tha table ? (this coul help me explain why in different machines the program
behaves differently)

"Richard Carter" <carte...@news.ececs.uc.edu> ha scritto nel messaggio
news:aelqqn$mic$1@news.ececs.uc.edu...

Quote
> Franco Jommi (franco.jom...@tin.it) wrote:
> : The same program is OK or fails depending on the machine is running on.
When
> : the path of a table is not specified, in one case the program defaults
to a
> : directory where that table exists, in anothe case where it doesn't exist
and
> : it fails. I tried to find out which is the table the program is using in
one
> : case or the other, but I didn't find a function for this, nor I found
out
> : why in one machine the program defaults to the directory of the exe and
not
> : in the other machine.

> Using what database engine?

> If the BDE, my advice is:
> 1) For large applications, or applications that may grow and
> expand, use alias names.

> 2) For small applications, using a single table or not much more,
> consider putting the table in the same directory with the .exe
> file.  Then, in the form's onCreate method:
> var s: string;
> begin
>   s := ExtractFilePath(Application.ExeName);
>   Table1.DatabaseName := s;
>   Table1.Open; file://when compiling, Table1.Active should be False
> end;
> --
> Rick Carter
> carte...@email.uc.edu   Rick.Car...@ParadoxCommunity.com
> Chair,   Paradox/Delphi SIG,   Cincinnati PC Users Group

Other Threads