I am trying to convert TFDMemTable
to a JSON String. I am trying to utilize SaveToStream
function, but it throws an NULL Access Violation.
Project XXX raised exception class $C0000005 with message 'access violation at 0x545c8d4f: read of address 0x00000008'.
A reproducible code below:
TFDMemTable *fd = new TFDMemTable(NULL);
TFieldDef *Field = fd->FieldDefs->AddFieldDef();
Field->Name = "Name";
Field->DataType = Db::ftString;
Field->Size = 100;
fd->Open();
fd->Insert();
fd->FieldByName("Name")->AsString = "Johnny";
fd->Post();
TStringStream *Stream = new TStringStream();
fd->SaveToStream(Stream, sfJSON);
I tried with dropping a TFDStanStorageJSONLink
also tried creating TStringStream
with a String.
IDE: Rad Studio 11.1. We had a similar working peice of code before upgrading from 10.1 Berlin. Thanks.