Subject Re: [IBO] IBO_Query, stalling on row fetch final code
Author Peter Chaisty
Hi Helen

Thanks for the reply and suggestion, the way I was searching through
the table was silly anyway, why I di it that way I will never know.

Below is the code I used.
It will be some time until I know if it has fixed the problem or not,
but I did notice in my madexcept log that a DNS lookup was failing at
the same time so it does indeed look like possibly a problem with TCP
resources or something similar.

Rgds

Peter

procedure TOdin_Server.CheckStockLevels;
begin
// Check stock levels in product table
Re_Order := False;

if (IB_Connection1.Connected) then
begin
try
With IB_StockQuery do
begin
open;
First;
//
//
// SQL in IB_StockQuery
// id is a unique key and never 0
// SELECT 1 id FROM PRODUCT
// WHERE (STOCK_ON_HAND < LOW_WATERMARK)
//
// If a field is fetched then we need to re-stock
//
If ( IB_StockQuery.Fields[0].value ) then Re_order := True;
close;
end;
except
writelog('Error in check stock levels function',0);
end;

end
else writelog('Restock Not carried out db not connected',0);

end;