Delphi Firedac Memory Tables -
i trying replace delphi clientdatasets worked fine slow on large data firedac memorytables create firedac memory table in data module , populate form. in form check record count of memory table , contains records. close memory table , reopen returns empty table after opening.
dataform.mtdebtran.filename := cdsdir + '/debtran.fds'; dataform.mtdebtran.createdataset dataform.mtdebtran.createdataset; dataform.mtdebtran.open; dataform.builddebtrantemp1(p1,p2,p3,p4,true,true); dataform.mtdebtran.savetofile(cdsdir + '/debtran',sfbinary); showmessage(inttostr(dataform.mtdebtran.recordcount)); dataform.mtdebtran.close; dataform.mtdebtran.open; showmessage(inttostr(dataform.mtdebtran.recordcount));`
is real code, , complete? you're calling createdataset twice in succession
dataform.mtdebtran.createdataset dataform.mtdebtran.createdataset;
for no apparent reason, anyway if mtdebtran dataset supposed contain data before first call createdataset, call empty it, because that's it's supposed do.
you "but returns empty table after opening." , presumably intended ask why case. well, in
dataform.mtdebtran.close; dataform.mtdebtran.open;
after call .close, mtdebtran contain no data, because dataset discards data when .close called , calling .open not restore - dataset still empty. data, need reload data file created in .savetofile. or not call .close in first place, of course.
btw, in code, mtdebtran member of dataform, in text of q. "i create firedac memory table in data module" presumably firedac table different 1 mtdebtran?
also btw, if mtdebtran tclientdataset, mentioning firedac tables in q , title irrelevant , misleading.
Comments
Post a Comment