Using Delphi 10.4, web core 1.5.5.2
I set up a myCloudData table with a field called date_stamp having type DateTime.
procedure TForm2.wBtnInsertClick(Sender: TObject);
var
ent: TmyCloudDataEntity;
tbl : TmyCloudDataTable;
s: string;
begin
tbl := nil;
//FTbNdx set earlier to the correct table index
tbl := WebmyCloudData1.Tables.Items[FTbNdx];
if Tbl<>nil then begin
Ent := tbl.Entities.Add;
Ent.Value['code'] := WebEdit1.Text;
... other fields
s := FormatDateTime('YYYY-MM-DD HH:NN:SS',now);
Ent.Value['date_stamp'] := S;
Ent.Insert;
end;
end;
This fails no matter what I set the date formatting to.
I cleared the table, and changed the field date_stamp type to nvarchar[20].
That "add record" code still failed.
I tried with s := 'TEST'; and it succeeded.
I tried s:='2020-11-01' - success.
With s:='2020-11-01 14:20'; it also succeeded, but the data stored in the table is:
2020-11-01%2014%3A20
Clearly the data is being "url char encoded".
This explains why the nvarchar[20] failed to accept FormatDateTime('YYYY-MM-DD HH:NN:SS',now); - because the resulting value will be longer than 20 chars encoded this way.
It probably explains the failure in accepting the DateTime as well - if the "variant as string to datetime" function can't handle %20 and %3A either...
Am I missing something blindingly obvious (again)?
How should I be sending text with spaces/special chars to ensure the data is stored "correctly"?
TIA
Cheers,
EdB