Helpful Information
 
 
Category: Delphi Programming
Can not modify read-only dataset

qrcoba:TSDQuery;
dmdata:datamodule;
DBRND:TSDDatabase;


qrcoba.Open;
qrcoba.Insert;
Oldstate := qrcoba.State;
qrcoba.FieldByName('Kode').AsString := Edit1.Text;
qrcoba.FieldByName('Nama').AsString := 'Timotius';
Try
if dmdata.DBRND.InTransaction then
dmdata.DBRND.Commit;
qrcoba.Post;
Except
if qrcoba.State =dsInsert Then qrCoba.Append else
if qrcoba.State =dsEdit Then qrCoba.Edit;
Raise;
end;

This code does not work when reach qrcoba.insert, the message error is "qrcoba:Can not modify read-only datase"

how to handle this ?

thank you

what r u want to do? never show message or fix problem?

Hi...

It looks like you are bringing back a query from a database
where there are relational links. This makes the result set not
updateable.

One answer is you need to set up another ADOCommand to
send back your updates. Something on the lines of

cm := TADOComand.Create(Self);
with cm do begin
Parameters.Clear;
Connection := [ADOconnectionObject in here] ;
CommandText := 'UPDATE SQL Statement here';
CommandType := cmdText;
Execute;
end; {with cm}
cm.Free;










privacy (GDPR)