Solved

Managing *.dbf tables

Posted on 2001-07-25
3
146 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
ID: 6317080
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
ID: 6320917
Such a long question, so short the answer!

Thanks meikl :)))
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6320988
:-) thanks

glad to helped you
good luck again

meikl ;-)
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi TcxGrid group footer summary 3 276
code issue 8 133
Create Database on Android via Delphi dbExpress 3 94
tvirtualstringtree freeze when load too manny images 10 63
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

831 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