Page 1 of 1

Troubles with datasetfield and Zeoslib

Posted: 09.07.2006, 21:26
by robsonselzelin
Hello everyone.

I'm using Zeoslib 6.5.1 Alpha (to access MySQL 5) on Delphi 6.

I'm using master/detail relationship between clientdasets by a datasetfield on the master clientdataset, but, when I open the master clientdataset, the detail fields have null values, although the detail clientdataset's recordcount property is greater than zero.

The same application with BDE (with ODBC) works fine. Debugging the Delphi's VCL, I noticed that in DB.pas unit, on TDataSet.OpenCursorComplete method, when the clientdataset state is changed to dsBrowse (in SetState method, line FState := Value;), with BDE, the Active property became True and fields got their values, but with Zeos that doesn't happen.

Can someone tell me what Zeoslib is supose to do, in the detail clientdataset, to get field values on this kind of master/detail relationship? Thanx.

P.S. Is necessary to say how to make the relationship between clientdatasets?

Posted: 09.07.2006, 22:05
by robsonselzelin
Well, I believe is better describe how to do the master/detail relationship:

- 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;

For more details, see:

http://bdn1.borland.com/article/0,1410,29825,00.html

Posted: 10.07.2006, 13:55
by robsonselzelin
Hi folks.

If I can't solve this strange behavior I'll have to switch Zeos for BDE. Please, help me. Thanx.

Posted: 10.07.2006, 14:47
by silviogs
Hi

first you could bring update zeoslib in link: http://users.telenet.be/mdaems/ to reinstall the package and to see if continue the error.

Yours truly

Silvio Guedes

Posted: 11.07.2006, 14:21
by robsonselzelin
I updated my ZeosLib to the last version but, unfortunaly, nothing happened.

If you guys want a copy of the programs using BDE and Zeos with different behaviours, I can send you by email with table structures and data also.

With BDE you'll need MySQL ODBC driver that is in the following link:

http://dev.mysql.com/get/Downloads/MyOD ... .br/mysql/

To see how to set all the dataset's propertys, see this Borland article:

http://bdn1.borland.com/article/0,1410,29825,00.html

This kind of relationship between clientdatasets is recommended by Borland, i.e., it's not only me that do this :) I believe it's very important ZeosLib work fine with this kind of master/detail relationship and I hope I can help to solve the problem with my examples. Thanx.

Posted: 14.03.2007, 17:51
by ogecrom
With Zeos 6.5.1 I had to set the dataset provider poFetchDetailsOnDemand to true. Then it got the correct values from the fields.

Posted: 27.03.2007, 15:12
by jose fermin
Somebody solved the problem??

I am using the new zeos components (6.6.1) and I set the dataset provider poFetchDetailsOnDemand to true, but nothing happens.

Somebody help me please!!

Posted: 28.03.2007, 12:21
by ogecrom
I've followed the instructions posted by robsonselzelin on 09.07.2006 18:05.

But used TZReadOnlyQuery instead of TZQuery and NOT setted the master and link fields on the detail query and setted the provider poFetchDetailsOnDemand.

I'm sending an example that works fine for fetch and update data.
(the applyupdates is fired by a double click on the form, I was in a hurry and too lazy to put a button).

Please let me know if it works or not, and what database are you using.

Posted: 28.03.2007, 16:10
by jose fermin
Hi ogecrom, let me tell you that it not work.

I'm using delphi 7, postgresql 8.2.1 and zeos 6.6.1.

one question,

what is the property poUseQuotechar??

When I opened your project it show a error "unknown property in datasetprovider options".

These are my tables:

CREATE TABLE facturacion.articulo
(
codigo_articulo integer NOT NULL DEFAULT nextval('articulo_codigo_articulo_seq'::regclass),
descripcion_articulo character varying(50) NOT NULL,
referencia_articulo character varying(50),
costo_articulo numeric(11,2) DEFAULT 0.00,
existencia_articulo numeric(10,2) DEFAULT 0.00,
existencia_minima_articulo numeric(10,2) DEFAULT 0.00,
unidad_medida_articulo character varying(25),
fecha_vencimiento_articulo date,
ubicacion_articulo character varying(60),
codigo_grupo integer,
CONSTRAINT articulo_pkey PRIMARY KEY (codigo_articulo),
CONSTRAINT articulo_codigo_grupo_fkey FOREIGN KEY (codigo_grupo)
REFERENCES facturacion.grupo_articulo (codigo_grupo) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE SET NULL
)

CREATE TABLE facturacion.precio
(
codigo_pre integer NOT NULL DEFAULT nextval('precio_codigo_pre_seq'::regclass),
precio_pre numeric(11,2) DEFAULT 0.00,
porciento_pre numeric(11,2) DEFAULT 0.00,
itbis_pre numeric(11,2) DEFAULT 0.00,
codigo_articulo integer DEFAULT buscar_codigo('codigo_articulo'::character varying, 'articulo'::character varying),
CONSTRAINT precio_pkey PRIMARY KEY (codigo_pre),
CONSTRAINT precio_codigo_articulo_fkey FOREIGN KEY (codigo_articulo)
REFERENCES facturacion.articulo (codigo_articulo) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE SET NULL
)

CREATE TABLE facturacion.grupo_articulo
(
codigo_grupo integer NOT NULL DEFAULT nextval('grupo_articulo_codigo_grupo_seq'::regclass),
descripcion_grupo character varying(30) NOT NULL,
observacion_grupo text,
CONSTRAINT grupo_articulo_pkey PRIMARY KEY (codigo_grupo)
)

the example is with the two first tables.

Thanks for help me my friend.

Posted: 28.03.2007, 20:28
by jose fermin
I did the same to you, but show a error ClientDataSet1: cannot perform this operation on a closed dataset

Troubles with datasetfield and Zeoslib

Posted: 28.03.2007, 20:58
by jose fermin
This is part of my project

Posted: 29.03.2007, 22:29
by jose fermin
I hope in the future zeos components has its own datasetproviders and clientdatasets.

Go ahead guys!!

Posted: 26.07.2007, 06:41
by snikolaidis
jose fermin wrote:I did the same to you, but show a error ClientDataSet1: cannot perform this operation on a closed dataset
Hi to all!

I'm new in ZeosLib; I want to replace the dbExpress library with ZeosLib, but I have exactly the same problem described by Jose.

Is there any solution?

Thank you in advance.