Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Particular field is not updated on Post


This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 4 - Last Post: Mar 2, 2016 4:32 AM Last Post By: Alexander Popov
Alexander Popov

Posts: 52
Registered: 7/22/05
Particular field is not updated on Post  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2016 2:05 AM
Hi!
I'm migrating my project from ADO(dbGO) to FireDAC.
One of my form contains several db-aware controls (edits, drop-down lists and memo), all the controls are linked to the same DataSet.
When user presses OK button on that form, I call DataSet.Post method, all fields are updated except the one field connected with drop-down lookup control. When I look to the trace in the profiler, I see the update statement without that field. Why could it happen? DataSet is in dsEdit state. To prove that the drop-down control actually changes the field value, I drop on the form a db-text label connected with that field. And I see that the value is being really changed. This form worked fine with ADO components. Insert for this field doesn't work as well. I use MS SQL Server, Delphi XE7, Intraweb + CGDevTools components.
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Particular field is not updated on Post
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 1, 2016 6:04 AM   in response to: Alexander Popov in response to: Alexander Popov
Options:
* Check that pfInUpdate is included into TField.ProviderFlags for this field.
* If you are using TFDUpdateSQL for this dataset, then check that the field
is included into TFDUpdateSQL.XxxxSQL command texts.

--
With best regards,
Dmitry
Alexander Popov

Posts: 52
Registered: 7/22/05
Re: Particular field is not updated on Post  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 2, 2016 2:22 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Hi, Dmitry!

Thank you for help.
You are right, ProviderFlags for this field were empty. Now, I add [pfInUpdate] flag to them when user selects an item in the drop-down list and it works.

But I'm curious, why it happened?
ADO worked fine with this query. The query is not very special, just one base table with attached dictionary tables.

SELECT     dbo.vu_perspective_sites.id_site, dbo.vu_perspective_sites.site_name, dbo.vu_perspective_sites.id_purpose, dbo.vu_perspective_sites.id_PI, dbo.vu_perspective_sites.site_characteristics, 
                      dbo.vu_perspective_sites.geom, dbo.s_pi_i.s_pi_i, dbo.s_tpi_purpose.purpose, dbo.s_site_status.site_status, dbo.vu_perspective_sites.id_site_status, dbo.v_vu_lc_numbers.lc_full_number, 
                      dbo.vu_perspective_sites.id_lc
FROM         dbo.vu_perspective_sites LEFT OUTER JOIN
                      dbo.v_vu_lc_numbers ON dbo.vu_perspective_sites.id_lc = dbo.v_vu_lc_numbers.id_lc LEFT OUTER JOIN
                      dbo.s_site_status ON dbo.vu_perspective_sites.id_site_status = dbo.s_site_status.id_site_status LEFT OUTER JOIN
                      dbo.s_tpi_purpose ON dbo.vu_perspective_sites.id_purpose = dbo.s_tpi_purpose.id_purpose LEFT OUTER JOIN
                      dbo.s_pi_i ON dbo.vu_perspective_sites.id_PI = dbo.s_pi_i.id_pi_i
where id_site = :id_site


The problem field is dbo.vu_perspective_sites.id_site_status from the base table.

Dmitry Arefiev wrote:
Options:
* Check that pfInUpdate is included into TField.ProviderFlags for this field.
* If you are using TFDUpdateSQL for this dataset, then check that the field
is included into TFDUpdateSQL.XxxxSQL command texts.

--
With best regards,
Dmitry
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Particular field is not updated on Post
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 2, 2016 3:27 AM   in response to: Alexander Popov in response to: Alexander Popov
But I'm curious, why it happened?
ADO worked fine with this query. The query is not very special, just one base table with attached dictionary tables.

ADODB does not use ProviderFlags, and only TClientDataSet and
FireDAC are using this property. Hard to say why it happened ...
Also, if the field is updatable and (it seems) you have persistent
fields, then just setup ProviderFlags at design-time. I does not see
a reason to setup it before editing / updating the field.

--
With best regards,
Dmitry
Alexander Popov

Posts: 52
Registered: 7/22/05
Re: Particular field is not updated on Post  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 2, 2016 4:32 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
ADODB does not use ProviderFlags, and only TClientDataSet and
FireDAC are using this property. Hard to say why it happened ...
Also, if the field is updatable and (it seems) you have persistent
fields, then just setup ProviderFlags at design-time. I does not see
a reason to setup it before editing / updating the field.

OK, thank you for the explanation and for the tip.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02