TMSQuery does not update view

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
bjoern
Posts: 2
Joined: Thu 28 Feb 2013 12:22

TMSQuery does not update view

Post by bjoern » Thu 28 Feb 2013 13:14

Hi,

I'm currently migrating a piece of software that was build 2005 with SDAC '2.3' to the newest version '6.6.12' with Delphi 7.
It includes a TMSQuery component that is used to edit data from several tables with selecting a single view. The old version has worked fine (all fields are editable), now after the migration only fields of the first table in the view are editable. Other fields are read-only.

I made a simple example to reproduce the issue:
The TMSQuery component selects data from a view (that contains a table with inner-join of another table):

Code: Select all

select * from dbo.View_1
Then I have generated the update statements:

Code: Select all

UPDATE dbo.table1
SET
  t1_dt_value = :t1_dt_value, t1_fk = :t1_fk
WHERE
  t1_pk_id = :Old_t1_pk_id

UPDATE dbo.table2
SET
  t2_dt_value = :t2_dt_value
WHERE
  t2_pk_id = :Old_t2_pk_id
Result:
The field t1_dt_value of table1 is editable.
The field t2_dt_value of table2 is NOT editable.
Both fields are editable when I open the same view with MS SQL Management Studio.

I read the compatibiliy notes but I did not found anything about that issue.

Many thanks in advance for any help,
Björn

AndreyZ

Re: TMSQuery does not update view

Post by AndreyZ » Fri 01 Mar 2013 08:42

Hello,

To solve the problem, you should set the TMSQuery.Options.SetFieldsReadOnly property to False.

bjoern
Posts: 2
Joined: Thu 28 Feb 2013 12:22

Re: TMSQuery does not update view

Post by bjoern » Fri 01 Mar 2013 13:41

Thank you, now it works!

AndreyZ

Re: TMSQuery does not update view

Post by AndreyZ » Fri 01 Mar 2013 15:18

I am glad I could help. If any other questions come up, please contact us.

Post Reply