Hi guys,
Can you help me with this?
I have a fragment of code that does the following:
It takes the data from Table1 and Table2 and joins it using a sql statement (select a.*,b.* from Table1 a, Table2 b where a.fieldname=b.fieldname) and puts it in a 3rd Table called c.dbf. But the Buttonclick procedure allows only 1 row of data (1 record). What I need is making possible that rows could be appended to c.dbf as data in Table2 changes (or gets appended).
Here's the code:
procedure TForm1.FormCreate(Sender: TObject);
begin
DBEdit9.Text := FormatDateTime('dd.mm.yyyy',Now);
FMXUtils.CopyFile('c:\windows\desktop\zbnalgl0.dbf','c:\windows\desktop\temp\');
RenameFile('c:\windows\desktop\temp\zbnalgl0.dbf', 'c:\windows\desktop\zbnalgl.dbf');
Table2.TableName:= 'zbnalgl.dbf';
Table2.Active:=True;
//
//
end;
procedure TForm1.Button1Click(Sender: TObject);
var t:ttable;
begin
Table2.Post;
Table2.Close;
//moe
Table1.Open;
Table2.Open;
//od EE
//
Table2.Edit;
DBEdit9.Text:=DateToStr(Date);
//Table2.Post; //
t := ttable.create(nil);
try
query1.open; //this query contains the sql-statement
t.databasename := query1.databasename;
t.tablename := 'c.dbf';
t.batchmove(query1,BatCopy); //this will create the table and insert the records from table1
finally
query1.close;
t.free; //release object instance
end;
//moe
Table2.Close;
//moe2
end;
Thanks, Blash
then use
t.batchmove(query1,BatAppe
or
t.batchmove(query1,BatUpda
meikl ;-)