ZUpdateObject example
Posted: 02.08.2018, 15:54
Hi
I try to use TZQuery and TZUpdateSQL with lazarus and it gives me headache.
the situation is : a datamodule with TZquery and TZUpdateSQL
TZQuery.UpdateObject is set to TZUpdateSQL component
TZQuery have a select query
TZUpdateSQL have an insert query
My code for insert is :
I get an exception because 'article_id' is unknow
So I try another method
Insert fail because all parameters are NULL (I can see complete request in zmonitor file)
What am I missing !!! (i'm sure component is not buggy, just not documented !!)
regards
PS : article_id is not the primary key
I try to use TZQuery and TZUpdateSQL with lazarus and it gives me headache.
the situation is : a datamodule with TZquery and TZUpdateSQL
TZQuery.UpdateObject is set to TZUpdateSQL component
TZQuery have a select query
Code: Select all
SELECT libelle, CodeCIP FROM t0
Code: Select all
INSERT INTO t0 (article_id, Libelle, CodeCIP) VALUES (:article_id, :Libelle, :CodeCIP)
Code: Select all
query.Insert;
query.paramByName('article_id').asInteger := FarticleId;
query.paramByName('Libelle').asString := EditLibelle.Text;
query.paramByName('CodeCIP').asString := EditCodeCIP.Text;
query.post
So I try another method
Code: Select all
query.Insert;
update.Params.paramByName('article_id').asInteger := FarticleId;
update.Params.paramByName('Libelle').asString := EditLibelle.Text;
update.Params.paramByName('CodeCIP').asString := EditCodeCIP.Text;
query.post
What am I missing !!! (i'm sure component is not buggy, just not documented !!)
regards
PS : article_id is not the primary key