Delphi - Using TMSTable with a SQL JOIN Statement results in error

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
B.T.
Posts: 1
Joined: Mon 15 Oct 2018 09:20

Delphi - Using TMSTable with a SQL JOIN Statement results in error

Post by B.T. » Mon 15 Oct 2018 11:32

After calling "Edit" on our Table it throws the error that a readonly Dataset can't be modifed.
The problem only occurs, if we have a JOIN in our statement.

Code: Select all

  TMyOwnTable = class(TMSTable)
...
var
  table: TMyOwnTable;
  sqlStatement: TStringList;
...
  sqlStatement.Add('SELECT TOP 100 master.* FROM (SELECT master.*, n2.Description AS Descr2 FROM MYTABLE master ');
  sqlStatement.Add('LEFT JOIN MYTABLE n2 ON master.JOINCOLUMN = n2.JOINCOLUMN) master');
  table.TableName := 'MYTABLE';
  table.UpdatingTable := 'MYTABLE';
  table.SQL.Assign(sqlStatement);
  table.Open;
  table.Edit;
In version 7.3.16 everything worked just fine.
With the newest version for Delphi 10.2 it doesn't. (8.1)

Thanks in regards
B.T.

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Delphi - Using TMSTable with a SQL JOIN Statement results in error

Post by Stellar » Wed 17 Oct 2018 07:24

The server can return a resulting dataset with the ReadOnly flag set, then SDAC will set the ReadOnly flag for the dataset. For a more detailed analysis of this behavior, please compose a small sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

Post Reply