tmptb.cardno表示没有的卡号
procedure TForm1.Button1Click(Sender: TObject);
vars:string;
distance, poir, first,last:Integer;
begin
Memo1.Clear;
Memo2.Clear;
qry1.Close;
qry1.SQL.Text :='select * from tmptb where cardno>0 order by cardno asc ';
qry1.Open;
qry1.First;
first := qry1.fieldbyname('cardno').AsInteger;
qry1.Next;
distance:=0;
poir := first;
while not qry1.Eof do
begin
last :=qry1.fieldbyname('cardno').AsInteger;
if poir+1=last then
begin
Inc(distance,+1);
poir := last;
end
else //重新定义开始和结束
begin //last已经是断开,范围应该是从first到poir
if distance>=100 then
begin
// s:='从'+inttostr(first)+'-->'+inttostr(poir);
// Memo1.Lines.Append(s);
Memo1.Lines.Append(inttostr(first));
Memo2.Lines.Append(inttostr(poir));
end;
first:= last;
poir := first;
distance :=0;
end;
qry1.Next;
end;
end;