Page 1 of 1

about "ZQuery.Open"

Posted: 20.08.2008, 07:20
by allegro

Code: Select all

  ZQuery2.SQL.Clear;
  ZQuery2.SQL.Add('select name from ip where ipstart< :pIP and ipend> :pIP ;');

repeat
...
    ZQuery2.Params[0].AsInteger:=iIP;
    ZQuery2.OPen;
    aRegion := VarToStr(ZQuery2['name']);  // only one record
...
until ...
only return the result for first time, why?

Posted: 20.08.2008, 07:29
by allegro
but this is ok.

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 ...

Posted: 20.08.2008, 12:34
by zippo
You're not closig the dataset in the first example. Maybe this could work:

Code: Select all

  ZQuery2.SQL.Clear;
  ZQuery2.SQL.Add('select name from ip where ipstart< :pIP and ipend> :pIP ;');

repeat
...
    ZQuery2.Close;
    ZQuery2.Params[0].AsInteger:=iIP;
    ZQuery2.Open;
    aRegion := VarToStr(ZQuery2['name']);  // only one record
...
until ... 

Posted: 26.08.2008, 09:06
by zippo
So... it's working?