Code: Select all
repeat
...
TmpQuery := 'select name from ip2name where ipstart<' + nIP + ' and ipend>' + nIP + ';';
ZQuery2.SQL.Clear;
ZQuery2.SQL.Add(TmpQuery);
ZQuery2.Open;
aRegion := VarToStr(ZQuery2['name']); // only one record
...
until ...