I can get UniLoader to work importing records into a MSSQL database if the destination table is empty. I cannot do it if there are any records in the table. I do not think it has anything to do with duplicate keys or anything like that. I go to some effort to delete any possible conflicts before I do the Load. The problem is it is hard to tell...there does not seem to be any error trapping at all. This is the crux of my question - how can I error trap UniLoader?
This is what I am doing
Code: Select all
UniLoader1.Connection := Master.iConnectUNI;
UniLoader1.tablename := xxTablename;
UniLoader1.CreateColumns;
UniLoader1.OnPutData := PutColumnData;If there are records in the table, a few records are loaded - then it basically freezes. Nothing happens - the program gets into a loop and the process has to be killed.
This is my Put procedure. There is a Primary key on the fields ID,TILLID.
Code: Select all
procedure TfrmSendToRegisters.PutColumnData(Sender: TDALoader); var
i: integer;
begin
i := 0;
if qryFastLoad.recordcount > 0 then
begin
ProgressBar2.MaxValue := qryFastLoad.recordcount;
while (not qryFastLoad.EOF) do
begin
inc(i);
try
ProgressBar2.UserValue := i;
Sender.PutColumnData('ID', i, qryFastLoad.FieldByName('ITEMID').AsString);
Sender.PutColumnData('TillID', i, qryFastLoad.FieldByName('TILL_NUMBER').AsString);
Sender.PutColumnData('COST', i, qryFastLoad.FieldByName('UNITCOST').AsFloat);
Sender.PutColumnData('SELL', i, qryFastLoad.FieldByName('PRICE1').AsFloat);
Sender.PutColumnData('INSTRUCTIONSID', i, qryFastLoad.FieldByName('INSTRUCTION').AsString);
Sender.PutColumnData('ENABLED', i, qryFastLoad.FieldByName('ENABLED').AsString);
qryFastLoad.next;
except
on e: exception do
begin
showmessage('Put Column Error ' + e.message);
end;
end;
end;
end;
end;