0

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.

1 Answer 1

0

The code above is fine, the problem is with the upgraded project file. If I try in a new project, it works. Ended up creating a new project file. My upgrade wows continues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.