Board index » delphi » How to: programatically adding a field to a table

How to: programatically adding a field to a table

Hi,
How can I add a new field to a table without using
database desktop.(for example a new filed called
lastUpdate, character, length 40)
I like to add it programatically.

Thanks
Mauricio

 

Re:How to: programatically adding a field to a table


I forgot to mention that the table
is a Paradox7 one.
bye

Re:How to: programatically adding a field to a table


Quote
> How can I add a new field to a table without using
> database desktop.(for example a new filed called
> lastUpdate, character, length 40)
> I like to add it programatically.

Check out this page: http://www.bdesupport.com/faq.htm

Your question appears on that page with a sample code snippet that uses the
SQL "ALTER TABLE" command to do what you are looking for.

This can also be done with dbiDoRestructure, but setting up the parameters
for that function call can be formidable.  We've used ALTER TABLE with great
success for upgrades that need to occur in the field at the customer's site
when they receive a new version of the software that requires a new field in
the table.

Vinnie Murdico
Software with Brains, Inc.
SWBTracker - Value-Priced Defect Management Software
http://www.softwarewithbrains.com

Re:How to: programatically adding a field to a table


If all you need is adding a field, the easiest (and therefore, the best)
solution is to use SQL's ALTER TABLE command. OTOH, if you need something
more robust, use DbiDoRestructure function (not an easy task).

I have made a wrapper component for DbiDoRestructure called TRestructure
Pro. You can download it from

http://sedlan.com/table_restructure.php

--
Jovan Sedlan
i...@sedlan.com
http://www.sedlan.com
#7 Components Home

Quote
"M Lumbrer" <mlumb...@lacapitalnet.com.ar> wrote in message

news:976b0q$5h134@bornews.inprise.com...
Quote
> I forgot to mention that the table
> is a Paradox7 one.
> bye

Other Threads