Master / Detail with Zeos

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
elidorio2
Expert Boarder
Expert Boarder
Posts: 159
Joined: 20.08.2006, 05:37
Location: Tapejara -Pr
Contact:

Master / Detail with Zeos

Post by elidorio2 »

Hello,
Please, someone teach me how to do a Master / Detail with Zeos.
Because it is a very basic example, just want to understand the concept of Zeos.


Thank you;
Edson
mparak
Senior Boarder
Senior Boarder
Posts: 81
Joined: 12.09.2005, 06:51
Location: Durban South Africa
Contact:

Post by mparak »

Hi Edson,

This very simple.

Form1.test_Master_Detail;
var Master,Detail:TzQuery ds_Master:TDatasource;
Begin
try
Master:=TzQuery.Create(application);
Master.connection:=Zconnection1;
Detail:=TzQuery.Create(application);
detail.connection:=Zconnection1;
ds_Master:=TDatasource.Create(application);
Master.sql.text:='select * from master_table';
Master.OPen;
ds_Master.dataset:=Master;
detail.datasource:=ds_Master;
detail.sql.text:='select * from detail_table where linkField=:linkField';
detail.open;
{
Master and detail are now opened and linked perfectly. Enjoy!
}
finally Master.free;Detail.free;ds_Master.free; end;
end;
Mohammed Parak
CAD RETAIL
Durban South Africa
http://www.cad.co.za
Post Reply