My problem is the time it seems to take to complete a batch update of 126 records to a Microsoft Access 2000 database connected using OLEDB 4.0. I am using the ADOTable component in Delphi 7.0
I have written code to extract data from an HTML file. My development test file involves extracting 126 instances of the data. Below I have removed the code used to extract the data but left the code I use within the loop to write each of the 126 records to the disconnected recordset. The cummulative time taken to write these 126 records is almost too short to measure, varying between 10 and 70 milliseconds. However once the extraction is completed and I do the BatchUpdate, that operation takes between 3700 and 4200 milliseconds!! That seems slow to me. Is that what I should expect? Is there anything I am doing incorrectly in the code I have included below, or are there any settings I should check related to the ADOConnection, etc, which may speed things up significantly?
ADOTable1.Active:=True;
while pos1 > 0 do begin
[Parsing code removed]
ADOTable1.Insert;
ADOTable1.FieldByName('BFEventId').Value :=
CurrentBFEventId;
ADOTable1.FieldByName('AmountMatched').Value :=
AmountMatched;
ADOTable1.FieldByName('BFRunnerID').Value := RunnerID;
ADOTable1.Post;
end;
ADOConnection1.Connected:=True;
ADOTable1.UpdateBatch(arAll);
I have written code to extract data from an HTML file. My development test file involves extracting 126 instances of the data. Below I have removed the code used to extract the data but left the code I use within the loop to write each of the 126 records to the disconnected recordset. The cummulative time taken to write these 126 records is almost too short to measure, varying between 10 and 70 milliseconds. However once the extraction is completed and I do the BatchUpdate, that operation takes between 3700 and 4200 milliseconds!! That seems slow to me. Is that what I should expect? Is there anything I am doing incorrectly in the code I have included below, or are there any settings I should check related to the ADOConnection, etc, which may speed things up significantly?
ADOTable1.Active:=True;
while pos1 > 0 do begin
[Parsing code removed]
ADOTable1.Insert;
ADOTable1.FieldByName('BFEventId').Value :=
CurrentBFEventId;
ADOTable1.FieldByName('AmountMatched').Value :=
AmountMatched;
ADOTable1.FieldByName('BFRunnerID').Value := RunnerID;
ADOTable1.Post;
end;
ADOConnection1.Connected:=True;
ADOTable1.UpdateBatch(arAll);