Troubles with datasetfield and Zeoslib
Moderators: gto, cipto_kh, EgonHugeist
-
- Fresh Boarder
- Posts: 8
- Joined: 09.07.2006, 20:56
- Contact:
Troubles with datasetfield and Zeoslib
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?
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?
-
- Fresh Boarder
- Posts: 8
- Joined: 09.07.2006, 20:56
- Contact:
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
- 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
-
- Fresh Boarder
- Posts: 8
- Joined: 09.07.2006, 20:56
- Contact:
-
- Junior Boarder
- Posts: 42
- Joined: 24.08.2005, 12:54
- Location: The Most Oriental Point of America - João Pessoa - Brazil
- Contact:
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
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
-
- Fresh Boarder
- Posts: 8
- Joined: 09.07.2006, 20:56
- Contact:
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.
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.
-
- Fresh Boarder
- Posts: 12
- Joined: 27.03.2007, 14:35
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.
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.
You do not have the required permissions to view the files attached to this post.
-
- Fresh Boarder
- Posts: 12
- Joined: 27.03.2007, 14:35
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.
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.
-
- Fresh Boarder
- Posts: 12
- Joined: 27.03.2007, 14:35
-
- Fresh Boarder
- Posts: 12
- Joined: 27.03.2007, 14:35
Troubles with datasetfield and Zeoslib
This is part of my project
You do not have the required permissions to view the files attached to this post.
-
- Fresh Boarder
- Posts: 12
- Joined: 27.03.2007, 14:35
-
- Fresh Boarder
- Posts: 1
- Joined: 25.07.2007, 07:24
- Location: Thessaloniki, Greece
Hi to all!jose fermin wrote:I did the same to you, but show a error ClientDataSet1: cannot perform this operation on a closed dataset
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.
Stratos Nikolaidis
Thessaloniki, Greece
Thessaloniki, Greece