First, I'm new to Delphi and Zeoslib, so pardon me if this is a stupid question, but:
- I have TZConnection, TZQuery and TZUpdateSQL
- TZQuery is data source for standard Delphi data controls (TDBEdit, TDBGrid) through a TDataSource
Now, when I set the SQL of TZQuery like this: 'SELECT * FROM PATIENT' (PATIENT is the name of a table in database), I can edit the values of current record in data controls.
But when my SQL is 'SELECT * FROM PL_PATIENT' ('PL_PATIENT' is the name of a stored procedure) all data controls become "readonly".
I'm not talking about making actual updates to database, only about being or not being able to edit the values in DB-aware controls. It works OK, even with complex sql queries, but it stops wroking when I use any name of a stored procedure.
Is this a bug?
Thanks!
TZQuery is read-only when using stored procedure in SQL
Moderators: gto, EgonHugeist
I see but what if I need more control over how my data get updated? I thought that TZUpdateSQL is there just to meet such requirement.
I mean, I want to select the data one way, and then insert/update completely other way (namely: using a stored procedure, which e.g. returns the value of the primary key, after I insert new record). So I don't want Zeoslib to guess anything, I want to create the sql parameters myself, and then assing field values to these parameters before insert/update, and then, after commiting the changes, I want to assign the values of output parameters back to the fields of TZQuery.
Is this possible? If so, can anybody please teach me how...
I mean, I want to select the data one way, and then insert/update completely other way (namely: using a stored procedure, which e.g. returns the value of the primary key, after I insert new record). So I don't want Zeoslib to guess anything, I want to create the sql parameters myself, and then assing field values to these parameters before insert/update, and then, after commiting the changes, I want to assign the values of output parameters back to the fields of TZQuery.
Is this possible? If so, can anybody please teach me how...
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Not sure if that complex situation is possible. But I was thinking it would/should be possible to update the fields when you're using TZUpdateSQL.
Have you tried setting the Fields Readonly property to false after opening the query?
To get back the primary key of the inserted row you could use the RefreshSql property of TZUpdateSql.
Mark
Have you tried setting the Fields Readonly property to false after opening the query?
To get back the primary key of the inserted row you could use the RefreshSql property of TZUpdateSql.
Mark
I have a similar Problem, but my sql Query is a Join one and looks something like this:
SELECT
"car"."idnt" AS "Indicator",
"car"."cnumer" AS "customer_numer",
(...)
"customer"."numer" AS "customernnumer",
"customer"."tel" AS "Phone",
(...)
"carmodelinfo"."id" AS "carmodelinfo_Id",
"carmodelinfo"."manufacturer" AS "Car Manufacturer",
(...)
FROM
(("car"
LEFT OUTER JOIN
"customer"
ON
"car"."cnumer" = "customer"."numer")
LEFT OUTER JOIN
"carmodelinfo"
ON
"car"."carmodelinfostamm_id" = "carmodelinfo"."id")
I'm using a ClientDataSet, and I wanted to manipulate the update action in the ClientDataSet.DataSetProbider.BeforeUpdateRecord event. This works just fine for non Join Queries, but when I use a Join, my fields are marked as Read-Only. And changing the property manually doesn't work.
Any Ideas how to mark the fields as non read-only?
I also tryed to use the ZUpdateSQL but the fields are still marked as read only...
SELECT
"car"."idnt" AS "Indicator",
"car"."cnumer" AS "customer_numer",
(...)
"customer"."numer" AS "customernnumer",
"customer"."tel" AS "Phone",
(...)
"carmodelinfo"."id" AS "carmodelinfo_Id",
"carmodelinfo"."manufacturer" AS "Car Manufacturer",
(...)
FROM
(("car"
LEFT OUTER JOIN
"customer"
ON
"car"."cnumer" = "customer"."numer")
LEFT OUTER JOIN
"carmodelinfo"
ON
"car"."carmodelinfostamm_id" = "carmodelinfo"."id")
I'm using a ClientDataSet, and I wanted to manipulate the update action in the ClientDataSet.DataSetProbider.BeforeUpdateRecord event. This works just fine for non Join Queries, but when I use a Join, my fields are marked as Read-Only. And changing the property manually doesn't work.
Any Ideas how to mark the fields as non read-only?
I also tryed to use the ZUpdateSQL but the fields are still marked as read only...