Board index » delphi » Database problems.

Database problems.

Hello gentlemen.

This is probably the 100th time that i wrote this... but in any case here it
goes...

I'd like to know if someone could tell me how to work with paradox tables
through delphi code.
Insert, delete, update, select, etc.
I know that it is possible using the objects like the "Table" and the
"DataSource", linked through alias... but what hapens if i change the
working directory ? A complete disaster.
Now,  the question is how can i make it dinamic so it can work always in the
program directory (where the tables are) ?

Thanks in advance.

Jorge Ferreira

 

Re:Database problems.


You can use any directory name instead alias name for your TTable or
TDatabase component!
So just set this property in run-time and open your tables after that (in
run-time too, of course).

--
With best regards, Mike Shkolnik
E-mail: mshkol...@scalabium.com
WEB: http://www.scalabium.com

Quote
Jorge Ferreira <jorge.mauri...@iol.pt> wrote in message

news:3d80d3f8@news.vizzavi.pt...
Quote
> Hello gentlemen.

> This is probably the 100th time that i wrote this... but in any case here
it
> goes...

> I'd like to know if someone could tell me how to work with paradox tables
> through delphi code.
> Insert, delete, update, select, etc.
> I know that it is possible using the objects like the "Table" and the
> "DataSource", linked through alias... but what hapens if i change the
> working directory ? A complete disaster.
> Now,  the question is how can i make it dinamic so it can work always in
the
> program directory (where the tables are) ?

> Thanks in advance.

> Jorge Ferreira

Re:Database problems.


Quote
"Jorge Ferreira" <jorge.mauri...@iol.pt> wrote:
>I know that it is possible using the objects like the "Table" and the
>"DataSource", linked through alias... but what hapens if i change the
>working directory ? A complete disaster.
>Now,  the question is how can i make it dinamic so it can work always in the
>program directory (where the tables are) ?

It's been a while since I referenced files in a local directory, but I
believe I got away with putting a '.' (to specify current directory)
for the directory name so that the program would use whatever data
files were found its own directory.
hth,
Myron

Re:Database problems.


C. Myron Ware (sun...@usa.NOSPAM.com) wrote:
: "Jorge Ferreira" <jorge.mauri...@iol.pt> wrote:
: >I know that it is possible using the objects like the "Table" and the
: >"DataSource", linked through alias... but what hapens if i change the
: >working directory ? A complete disaster.
: >Now,  the question is how can i make it dinamic so it can work always in the
: >program directory (where the tables are) ?

: It's been a while since I referenced files in a local directory, but I
: believe I got away with putting a '.' (to specify current directory)
: for the directory name so that the program would use whatever data
: files were found its own directory.

I don't think a dot by itself works; probably what you used was '.\'
(without the quotes) to tell it to use the current directory.
That's one way, but I've found two other ways that work better:

Better: Leave the DataSource completely blank.

Best: In the form's open method, or somewhere else after the form
is created:
  Table1.DataSource := ExtractFilePath(Application.ExeName);
(Requires having the table closed (Active = False) at design time,
and following the above line with a line to open the table.)
--
Rick Carter
carte...@email.uc.edu   Rick.Car...@ParadoxCommunity.com
Chair,   Paradox/Delphi SIG,   Cincinnati PC Users Group

Re:Database problems.


Quote
"Jorge Ferreira" <jorge.mauri...@iol.pt> wrote in message

news:3d80d3f8@news.vizzavi.pt...

Quote
> Hello gentlemen.

> This is probably the 100th time that i wrote this... but in any case here
it
> goes...

> I'd like to know if someone could tell me how to work with paradox tables
> through delphi code.
> Insert, delete, update, select, etc.

table.Insert, table.Delete, table.Post
table.Locate()  followed by table.Edit

Quote
> I know that it is possible using the objects like the "Table" and the
> "DataSource", linked through alias... but what hapens if i change the
> working directory ? A complete disaster.

No, alias's are specifically designed to make a change of a
working directory easy.

Quote
> Now,  the question is how can i make it dinamic so it can work always in
the
> program directory (where the tables are) ?

Do NOT put data into the program directory. It makes
backups larger than necessary. But there is also an issue
with the Paradox Lock file which continues to grow
in this configuration until the program crashes with
a "Lock file too large" error.

PR

Other Threads