Problem with select queries. lazarus / 16-Databases ---------------------------------------------------------------------- nazim · 2005-12-04 23:12 I'm currently using embedded Firebird 1.5 with the SQLdb components. If I use code such as that below, without going through a data source and db components, and ask for the record count of the query, I only ever get a maximum of 10 results. However, when I attach a data source along with a db grid, I can see all of the results. Code: [Select]with query do begin   close;   sql.clear;   sql.add('SELECT * FROM table;');   open;   if RecordCount > 0 then   begin     StringGrid1.RowCount := RecordCount + 1;     for i := 1 to RecordCount do     begin       StringGrid1.Cells[1, i] := fields.FieldByName('id').AsString;       next;     end;   end; end; I've also tried using the FIBL and Interbase components and have observed the same behaviour, although I did not have this problem with the ZEOS library (which I cannot use because of the problem with the date fields). Does any one know what I'm doing wrong? Many thanks. ---------------------------------------------------------------------- jesusr · 2005-12-05 06:52 What happen is that dataset has a default buffer count of 10, so when you open the query that's the max amount of records already on buffers, this is further enforced by the fact that you use a for loop limited by the amout of 10 records. this variant might help: Code: [Select] with query do begin  close;  sql.clear;  sql.add('SELECT * FROM table;');  open;  i:=0;  StringGrid1.RowCount:=1; // just the column headers :)  while not EOF do  begin   inc(i);   StringGrid1.RowCount := i+1;   StringGrid1.Cells[1, i] := FieldByName('id').AsString;   next;  end; end; Untested!, you might consider to retrieve the amount of records by a query like 'SELECT COUNT(id) from Table' if you really want that. ---------------------------------------------------------------------- nazim · 2005-12-05 18:41 Thank you very much Jesus, the alterations you made work perfectly.