Hello,
I get an error when I run the line ADataSet.LoadFromJSON
I am not sure it is an error due to your (wonderful) library, but still I don't understand why it happens. Here is the code:
Procedure PrepareDataSet(JsonContent: String);
Var
AField: TField;
ADataSet: TFDMemTable;
begin
ADataSet := TFDMemTable.Create(nil);
AField := TIntegerField.Create(ADataSet);
AField.Name := '';
AField.FieldName := 'BILL_ID';
AField.DataSet := ADataSet;
ADataSet.Active := True;
ADataSet.LoadFromJSON(JsonContent); // ERROR happens here: Error:Access violation at address 000000000096FCA4 in module 'FunctionExportContactsForSamWin.exe'. Read of address 0000000000000000.
ADataSet.Free;
end;
When I look the exact line where the error happens, it is here, the file Data.DB:
procedure TStringField.SetAsAnsiString(const Value: AnsiString);
var
Len: Integer;
begin
Len := Integer(Length(PAnsiChar(Value)) + 1);
if DataSize < Len then
Len := DataSize;
Move(PAnsiChar(Value)^, PAnsiChar(@FIOBuffer[0])^, Len - 1);
FIOBuffer[Len - 1] := 0;
if Transliterate then
DataSet.Translate(PAnsiChar(@FIOBuffer[0]), PAnsiChar(@FIOBuffer[0]), True);
SetData(FIOBuffer);
end;
The variable DataSet is evaluated to nil
Please note that when I execute ADataSet.LoadFromJSON(JsonContent); without defining the field types, the import is correct. But I need the fields to be typed.
Hello, I get an error when I run the line
ADataSet.LoadFromJSON
I am not sure it is an error due to your (wonderful) library, but still I don't understand why it happens. Here is the code:When I look the exact line where the error happens, it is here, the file
Data.DB
:The variable
DataSet
is evaluated tonil
Please note that when I execute
ADataSet.LoadFromJSON(JsonContent);
without defining the field types, the import is correct. But I need the fields to be typed.Thank you