Copy field

Hi
i'm developping a project with delphi 7 and  I need to copy some fields from one table in paradox 9 to another table in paradox 9 .
Somebody help me please .
Celina SisiAsked:
Who is Participating?
 
Geert GConnect With a Mentor Oracle dbaCommented:
Records and columns ...
you need to position the 2nd table according to the primary key of the first table

var f: TField;
  I: Integer;

if table2.Locate('ID', table1.FieldByName('ID').Value, []) then 
begin
  for i := 0 to table2.FieldCount-1 do 
  begin
    f := table1.FindField(table2.Fields[I].FieldName);
    if f <> nil then 
      table2.Fields[I].Value := f.Value;
  end;
end;

Open in new window

0
 
Sinisa VukCommented:
Example depends on what you do - insert new record in second table or do edit...
Here is example of inserting new record. You must have two connection components - each to one for different paradox version.
Add two table component attach one to first connection component, second to second conn. comp.
...
Table2.Append;
Table1.Open;
Table2.FieldByName('Field1').AsInteger := Table1.FieldByName('Field8').AsInteger;
Table2.FieldByName('Field2').AsString := Table1.FieldByName('Field3').AsString;
Table2.Post;
...

Open in new window

0
 
Celina SisiAuthor Commented:
thanks
i want exactly copy the same data in one field from the first table to the second table
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Sinisa VukCommented:
What do you think "exact" data? If field1 in Table 1 is "A" - then this value "A" is assign to field1 in Table2 - as is.
0
 
Celina SisiAuthor Commented:
yes exactly like that
0
 
Sinisa VukCommented:
...then my example works... have you try it?
0
 
Celina SisiAuthor Commented:
i will try and i will tell you
thanks
0
 
Geert GOracle dbaCommented:
why are you using Paradox in this Millenium ?
Paradox is from days long gone.
0
 
Celina SisiAuthor Commented:
you are right but i prefere it
0
 
Geert GOracle dbaCommented:
you prefer Paradox ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.