#1 2019-08-30 12:38:36

Codorna
Member
Registered: 2018-06-26
Posts: 21

Access Violation (AV) on TSQLRecord.GetID

I got a table with a 1:1 reference to another and when retrieving values, when the Id is too high, I'm getting an AV, what should I do ? The ID is over $100000 and this messes up the ORM

on the TSQLRecord:
    property reg : TReg0200 read fReg write fReg; //this is another TSQLRecord


loading data:

...
  RetrieveList<TAgrupamentoConsistencia>('', []);
...
  for obj in list do
    obj.reg := TReg0200.Create(Server, obj.reg.Id);

also tried obj.reg , obj.reg.AsTSQLRecord

Offline

#2 2019-08-30 12:56:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Access Violation (AV) on TSQLRecord.GetID

Your code is incorrect, or incomplete.
You use obj.reg.ID before setting obj.reg.
So instances and IDs are confused...

Try with TID(obj.reg).

Note that even if it worked, obj.reg instance are most probably not freed - so you leak memory.

Offline

#3 2019-08-30 19:16:35

Codorna
Member
Registered: 2018-06-26
Posts: 21

Re: Access Violation (AV) on TSQLRecord.GetID

I free it later, that list in the for is the one retrieved by RetrieveList , I already fixed changing the SQLRecord to TID and loading on another field, gonna try TID(object) next time, thanks

Offline

Board footer

Powered by FluxBB