Page 1 of 1

TPgQuery in editing mode

Posted: Mon 31 Aug 2020 05:08
by mx12
Hi,
I am kind of struggeling with TPgQuery using in edit mode - it means that a simple query "select * from table1" is executed, passed through DataSource to DBGrid and user is able to edit the data and dataset will post changes in to the database. table1 have primary key "id bigserial", I tried to use standard Datasource and Devarts as well, standard DBGrid and CRDBGrid, TPgQuery Readonly is false, I have tried to change its ReadOnly, UniDirectional, UpdatingTable and KeyFilds parameters according to manual but no result, even DBNAvigator enables only buttons to "navigate" through dataset no to edit.... So what am I doing wrong and parameters should be set to enable direct user editing through DBGrid, or in other words what paramaters switches the "readonly" and editing mode.
Thanks

Re: TPgQuery in editing mode

Posted: Thu 03 Sep 2020 06:48
by oleg0k
Hello,
Unfortunately, we couldn't reproduce the issue.
Please send us an example demonstrating the incorrect behavior, along with the DDL scripts for creating and populating the database objects (or the backup file/database file).

wbr, Oleg
Devart Team

Re: TPgQuery in editing mode

Posted: Thu 03 Sep 2020 08:17
by mx12
I will try to make it work... if not I will provide necessary information.
But as I understand it - TPgQuery object should be ready for user to edit data with connected grid component and just ReadOnly parameter changes its behavior if it is editable grid or just showing some data (view result) with no option to edit provided data?
And parameters UpdatingTable and KeyFilds are needed just if PgQuery was not able to automatically retrieve them from server?
Thanks

Re: TPgQuery in editing mode

Posted: Thu 03 Sep 2020 13:17
by oleg0k
Hello,
Unfortunately, this information is not enough to reproduce the issue. We need a sample project that demonstrates the incorrect behavior, as well as your DDL scripts for creating and populating the database objects. Please send them through the form on our website:https://devart.com/company/contactform.html

wbr, Oleg
Devart Team

Re: TPgQuery in editing mode

Posted: Mon 07 Sep 2020 09:15
by mx12
Hello,

so far I identified the problem: trying on simple project just Connection, PgQuery, DataSource and Grid, when I set everything in design time - connection and PGQuery.SQL (SELECT * FROM tbl1;) and activate it - I am able to edit data in Query (in runtime), Also when I run execute on query in runtime but I did not touch SQL parameter, I am able to edit data in runtime.

But as far as I change SQL parameter in runtime:
pgQuery1.Active := false;
pgQuery1.SQL.Clear;
pgQuery1.SQL.Add(Edit1.Text);
pgQuery1.Execute; // or pgQuery1.Active := trure; it doesnt makes a difference

data in Grid are not editable... should I execute some prepare statement or force Query to refresh and retrieve key fields and updating table parameters?

thanks a lot

Re: TPgQuery in editing mode

Posted: Thu 29 Oct 2020 21:51
by oleg0k
Hello,
Unfortunately, we couldn't reproduce the issue.
We need a sample project that demonstrates the incorrect behavior, as well as your DDL scripts for creating and populating the database objects. Please send them through the form on our website:https://devart.com/company/contactform.html

wbr, Oleg
Devart Team