Solved

Managing *.dbf tables

Posted on 2001-07-25
3
145 Views
Last Modified: 2012-05-04
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
0
Comment
Question by:blash
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
Comment Utility
if c.dbf already exists,
then use
t.batchmove(query1,BatAppend);
or
t.batchmove(query1,BatUpdateAppend); //??is the name relly so

meikl ;-)
0
 

Author Comment

by:blash
Comment Utility
Such a long question, so short the answer!

Thanks meikl :)))
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
:-) thanks

glad to helped you
good luck again

meikl ;-)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
proper way to parse url in delphi 2 130
ddeman not working in activex 3 78
FMX enumerated colours 2 70
control image tags in a string ? 12 58
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now