Board index » delphi » Q: changing field name at runtime?

Q: changing field name at runtime?

Hello to everybody,

how do I change a FieldName in a paradox table at runtime?
FIeldName.= ....
FieldDefs.Items[i].Name.....
FIeldDef.Name....
don`t work.
What about Update?

Thanks for any hint?

regards,
Matthias

 

Re:Q: changing field name at runtime?


AFIK, you must create a new field with the new name, copy the data
from the old field, then delete the old field, or some other method
which does essentially the same thing. eg, you can create a new table
using the field defs from the old one, but substituting the new field
name for the old, then use a batch move to copy the data. Use the
mappings property of batch move to get the data into the new field
name.

If this has to be done for an upgrade at remote sites, there probably
are things that have to be done a certain way. I have not needed to do
this, so you should get more opinions than just mine.

HTH,
Dan

HTH,
Dan

On Mon, 05 Feb 2001 17:32:15 +0100, Matthias Nickola

Quote
<M.Nick...@mto-net.de> wrote:
>Hello to everybody,

>how do I change a FieldName in a paradox table at runtime?
>FIeldName.= ....
>FieldDefs.Items[i].Name.....
>FIeldDef.Name....
>don`t work.
>What about Update?

>Thanks for any hint?

>regards,
>Matthias

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com
[SPAM block: change at to @ in my e-mail address]

Re:Q: changing field name at runtime?


Quote
Matthias Nickola wrote:

> how do I change a FieldName in a paradox table at runtime?
> FIeldName.= ....

Last autumn, I posted here code how to change field lengths in
Paradox table.
http://x58.deja.com/=dnc/getdoc.xp?AN=683731158.2&CONTEXT=981419635.1...

With two lines changed, the same unit is able  to rename the Fields
also.

  begin
    Fillchar(aChangeRec, sizeof(aChangeRec), 0); {Fill rec with zeros}
    StrPCopy(aChangeRec.szName, 'NewFldName');   {The new Fieldname }
    ChangeField(Dpath, aTable, 'OldFldName', aChangeRec); {OldName --> NewName}
  end;

Markku Nevalainen

Other Threads