#1 2024-09-23 11:34:45

youssef
Member
Registered: 2024-08-05
Posts: 6

TOrmTableDataSet3 being Read-Only after Loading Data via CreateFromJso

I’m facing a problem where TOrmTableDataSet3 is read-only, preventing me from modifying the dataset.

I'm loading the dataset using TOrmTableDataSet.CreateFromJson. Here's the code I’m using for appending data:

UniEdit1.onkeyPress
  with DataSource1.DataSet do
    begin
      Append;
      FieldByName('NewQty').AsString := 'AG-' + Format('%', [UniEdit1.Text]);
    end;

However, I keep getting the error => TOrmTableDataSet3: Cannot modify a read-only dataset.

Offline

#2 2024-09-23 19:13:45

tbo
Member
Registered: 2015-04-20
Posts: 353

Re: TOrmTableDataSet3 being Read-Only after Loading Data via CreateFromJso

youssef wrote:

However, I keep getting the error => TOrmTableDataSet3: Cannot modify a read-only dataset.

What is your question?

With best regards
Thomas

Offline

#3 2024-09-23 20:06:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,682
Website

Re: TOrmTableDataSet3 being Read-Only after Loading Data via CreateFromJso

It is a read-only dataset by design.
It is a TDataSet which maps the JSON values.

If you want to modify the dataset content, you need a read/write dataset.
For instance, you can use https://github.com/synopse/mORMot2/blob … ui.cds.pas which uses a TClientDataSet for a read/write storage.

Offline

Board footer

Powered by FluxBB