Board index » delphi » Add a new Database field to a already-existing Paradox table at RUNTIME

Add a new Database field to a already-existing Paradox table at RUNTIME

Hi,

Can anybody inform me about how to add a new Database field to a
already-existing paradox table
at runtime.

Note:
Delphi 5.0 Help say that I can't use "AddFieldDef" because it cannot be used
to add fields to an already-existing table.

Any help is highly appreciated.

Regards
Steffen

 

Re:Add a new Database field to a already-existing Paradox table at RUNTIME


On Thu, 17 Feb 2000 14:22:28 +0100, "Steffen Kristensen"

Quote
<Stef...@L-and-B.dk> wrote:
>Can anybody inform me about how to add a new Database field to a
>already-existing paradox table
>at runtime.

>Note:
>Delphi 5.0 Help say that I can't use "AddFieldDef" because it cannot be used
>to add fields to an already-existing table.

There are a number of ways you might do this. Here are two, in order of
increasing complexity/difficulty of use.

Use the local SQL statement ALTER TABLE, executed from a TQuery.

  ALTER TABLE "Customer.db"
  DROP COLUMN FullName
    ADD COLUMN LastName CHAR(35)
    ADD FirstName CHAR(25)

Local SQL (the SQL implementation the BDE uses for dBASE, Paradox, and
FoxPro tables) is documented in the online help file LOCALSQL.HLP, found in
the main BDE directory. This help file is a language reference of the local
SQL implementation (subset) of SQL-92. The copy of this file that came with
BDE 4.x (and earlier versions) was seriously out of date and contained
little useful information. It has since been rewritten. It has been updated
again concurrent with C++Builder 5. Updated copies will have the topic
"VIEWs" in the index (and lack of this topic indicates a pre-update copy).
I can e-mail you a copy of the updated file if you need and desire it.

Another way is with the BDE API function DbiDoRestructure. BDE API
functions are documented in the BDE online help, BDE32.HLP, found in the
main BDE directory. To make a direct call to a BDE API function from a
Delphi unit, the BDE wrapper unit named "BDE" must be named in the unit's
Uses section.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Health nuts are going to feel stupid someday,
Felton, CA                  lying in hospitals dying of nothing."
                                                              -- Redd Foxx

Re:Add a new Database field to a already-existing Paradox table at RUNTIME


In article <88gscs$8m...@news.inet.tele.dk>, Steffen Kristensen
<Stef...@L-and-B.dk> writes
Quote
>Hi,

>Can anybody inform me about how to add a new Database field to a
>already-existing paradox table
>at runtime.

>Note:
>Delphi 5.0 Help say that I can't use "AddFieldDef" because it cannot be used
>to add fields to an already-existing table.

>Any help is highly appreciated.

>Regards
>Steffen

I have a program which does this, using dbidorestructure,  you are
welcome to a copy if you email me, pete at elmsoft dot demon dot co dot
uk.

I am trying to find the field type of a Money (Currency) field without
success - strings, dates, time, no problem...  anyone know it?

--
Pete Clark

Replies to pete at elmsoft demon co uk

Re:Add a new Database field to a already-existing Paradox table at RUNTIME


Quote
On Sat, 19 Feb 2000 14:41:15 +0000, Pete Clark <P...@nowhere.atall> wrote:

[...]

Quote
>I am trying to find the field type of a Money (Currency) field without
>success - strings, dates, time, no problem...  anyone know it?

What "field type" is it you are having trouble determining? The native BDE
field type designation (fldstMONEY)? Or the BDE field type and subtype (7
and 21)? Or the local SQL field type (CURRENCY)?

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Steve Koterski              "Nothing is impossible for the man who doesn't
Felton, CA                  have to do it himself."
                                                           -- A. H. Weiler

Re:Add a new Database field to a already-existing Paradox table at RUNTIME


        Oi...

        Create a blank new table with with the old fields + the new
field...

        batch move all records to the new table

        close both tables

        rename old table to *.bak
        rename new table to the name it should be (*.px)

        ZEE

On Thu, 17 Feb 2000 14:22:28 +0100, "Steffen Kristensen"

Quote
<Stef...@L-and-B.dk> wrote:

[]Hi,
[]
[]Can anybody inform me about how to add a new Database field to
a
[]already-existing paradox table
[]at runtime.
[]
[]Note:
[]Delphi 5.0 Help say that I can't use "AddFieldDef" because it
cannot be used
[]to add fields to an already-existing table.
[]
[]Any help is highly appreciated.
[]
[]Regards
[]Steffen
[]
[]

::::::::::::::::::::::::::::::::ZEE_______JLNCF
::::::::::::::::::::::::::::::::Fafe___Portugal
::::::::::::::::::::::::::::::::z...@ibit.pt
::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::www.ibit.pt
::::::::::::::::::::::::::::::::1K dots

Other Threads