A shout-out to the Delphi gods:
Im maintaining a Delphi7 application that uses Paradox tables (BDEv5.2.0.2).
One of its functions is to export records from a table to a txt file in a fixed format. There are some 289 fields in the source table(s) and the user can export any number of these fields. The record length with all 289 fields is 4132 bytes. The export is successful when the number of fields to export is limited (that is, if the record size is 4096 bytes or less). However, if all the fields are exported, the app gets an error: "Access violation at address 4BDE68FC in module IDAPI32.DLL." The funny thing is that if there is only one record in the source table, all the fields can be exported successfully; on multiple records, it gets the access violation error.
When I ran it in debug mode, it was failing on the Post of the second record. Here is the gist of the code:
while not ExpSet.EOF do //while not last rec
begin
try
Common.CopyRecordFldsByName(FldBuf, ExpSet); //copy fields
with FldBuf do if Assigned(BeforePost) then BeforePost(FldBuf);
TblTextFile.Append;
CopyToText(IntMap); //copy values to txt
TblTextFile.Post; //<--- fails here on 2nd rec
except
on ESkipRecord do; //Do nothing
on E: Exception do
begin
TblTextFile.Cancel;
Inc(FIxpErrCount);
LogIxpError(GauImpExp.Progress + 1, E.Message);
if ChkAbortOnErr.Checked and
(FIxpErrCount >= BtnMaxErrors.Position) then
Break;
end;
end;
For anyone that can help me, I thank you in advance.