Board index » delphi » TDataSet.Next not working

TDataSet.Next not working

The following snippit is a simple loop that the program pointer is
going straight through.  The RecNo is incremented properly, EOF is
false, and the first string is written to ListBox1, but that's it:

 with Table1 do begin
  First;
  if not EOF then
  begin
   ListBox1.Items.Add(Table1FieldName.Value);
   Next;
  end;
 end;

 

Re:TDataSet.Next not working


Quote
> with Table1 do begin
>  First;
   while not EOF do
>  begin
>   ListBox1.Items.Add(Table1FieldName.Value);
>   Next;
>  end;
> end;

Re:TDataSet.Next not working


There is no loop in your code. It will execute one time and that is all.
Try:

with Table1 do begin
  First;
  while not EOF then
  begin
   ListBox1.Items.Add(Table1FieldName.Value);
   Next;
  end;
 end;

Bill
--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Other Threads