Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Debates (https://www.clubdelphi.com/foros/forumdisplay.php?f=29)
-   -   Programacion en 3 capas usando zeos components (https://www.clubdelphi.com/foros/showthread.php?t=41868)

Jose Fermin 28-03-2007 03:30:28

Programacion en 3 capas usando zeos components
 
Habra por aqui algun experto sobre programacion en 3 capas q use la combinacion d delphi 7 + zeos components + postgresql 8.2.

Cuando hablo d 3 capas me refiero a usar componentes: zquerys, datasetproviders, clientdataset, datasource y dbgrids.

Yo me he guiado del siguiente ejemplo:

- Create a Form and a DataModule;
- Change the creation order (Project/Options menu, Auto-create forms). Datamodule must be created first;
- Add one ZConection, two ZQuerys, two Clientdatasets, one Datasource and one DatasetProvider on the Datamodule;
- Set following propertys:

- Configure ZConnection;

- DataSource1:
DataSet: ZQuery1

- ZQuery1:
- Set Connection property;
SQL: select fields from master_table
- Double click on ZQuery1, right mouse button click, option Add All fields;

- ZQuery2:
- Set Connection property;
SQL: select fields from detail_table
- Double click on ZQuery2, right mouse button click, option Add All fields;
MasterSource: DataSource1
MasterField: Master field
IndexFieldNames: Detail field

- DatasetProvider:
Dataset: ZQuery1

- ClientdataSet1:
ProviderName: DataSetProvider1
- Double click on ClientdataSet1, right mouse button click, option Add All fields;

- ClientdataSet2:
DatasetField: ClientdataSet1ZQuery2 //Yes, this is the name of the TDataSetField created by ClientDataSet1
- Double click on ClientdataSet2, right mouse button click, option Add All fields;

The relationship is ready. File/Use Unit menu: DataModule2. To see the results, on Form1, put two dbnavigators, two dbgrids and two datasources. Configure following propertys:

- DataSource1:
DataSet: Datamodule2.ClientDataSet1

- DataSource2:
DataSet: Datamodule2.ClientDataSet2

Link dbnavigators and dbgrids properly and write following OnCreate's Form1 event:

DataModule1.ClientDataSet1.Close;
DataModule1.ClientDataSet1.Open;

Pero a la hora d probar el programa me doy cuenta d q en la parte d detalles todo sale NULL y no he encontrado la forma d resolver este problema.

Habrá algun gurú q me ayude con este problema??


La franja horaria es GMT +2. Ahora son las 18:43:14.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi