Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 1 of 1 total
Thread Dataset.Update + Dataset.Save - no data changed?
Thu, Jul 21 2022 5:52 PMPermanent Link

Ralf Mimoun

Hi,

next problem Smile

In a Server Application, I have a dataset "MapTrack" with two commands:

- Select:
SELECT * FROM MapTrack;

- Update:
UPDATE "MapTrack" SET
"ID" = :ID,
"SourceID" = :SourceID,
"Track" = :Track
WHERE "ID" = :Old_ID;

The table definition:

CREATE TABLE IF NOT EXISTS "MapTrack"
(
  "ID" GUID,
  "SourceID" GUID NOT NULL,
  "Track" MEMO,
PRIMARY KEY ("ID") COMPRESS NONE
LOCALE CODE 0
USER MAJOR VERSION 1
);

So, it's the generated stuff. Then I try

   dsMapTrack.Open;
   try
     Database.LoadRows(dsMapTrack);
     if dsMapTrack.RowCount >0 then begin
       dsMapTrack.First;
       dsMapTrack.Update;
       dsMapTrack.Columns['Track'].AsString := 'test';
       dsMapTrack.Save;
     end;
   except
     on e: exception do begin
       aRequest.SendError(HTTP_BAD_REQUEST, e.message);
     exit;
     end;
   end;
   Request.SendContent('All good, ID is ' + dsMapTrack.Columns['Track'].AsString);


I get no exception, error or anything else. But what I also don't get is the "test" string in the field "Track". The table has one record, and RowCount is larger than 0. I have put a Request.SendContent('', HTTP_OK, IntToStr(dsMapTrack.RowCount)); directly after the LoadRows and .Save to be sure.

It's the last thing I need to implement the last feature. But for that, I have to store some data.

Oh, and if anyone knows a way to define a command on the server side and call it with parameters from the client, I'd be thankful SmileI would not need the server application if something like that would be possible.
Image