Recent

Author Topic: dbgrid scrollbars  (Read 7222 times)

lordoza

  • Newbie
  • Posts: 3
dbgrid scrollbars
« on: August 21, 2006, 04:57:48 pm »
Hi,
im developing some database app under win32 which use dbGrid to show some data , when i load data to dbGrid from SQLQuery vertical scroll bar is always the same and it is "calculated" after scrolling down its very annoying.
It is normal ?
im using latest snapshot.

Kknd

  • New Member
  • *
  • Posts: 14
    • http://rpgfrontier.awardspace.com
RE: dbgrid scrollbars
« Reply #1 on: August 21, 2006, 07:09:27 pm »
Im using the latest snapshot too, but i dont have this problem. But im using a SQLite db. Win 32 too.

jesusr

  • Sr. Member
  • ****
  • Posts: 484
Re: dbgrid scrollbars
« Reply #2 on: August 22, 2006, 12:54:29 am »
Quote from: "lordoza"
Hi,
im developing some database app under win32 which use dbGrid to show some data , when i load data to dbGrid from SQLQuery vertical scroll bar is always the same and it is "calculated" after scrolling down its very annoying.
It is normal ?
im using latest snapshot.


This is the normal behaviour, the grid doesn't retrieve all records when you open the dataset, it only retrieve the needed visual records.

Some dataset implementatios do retrieve all records as Tdbf and it seems sqlite also.

For SqlQuery you can fetch all records when you open the dataset by setting PacketRecords property to -1 in object inspector or if you want to do it in code and your dataset is ds then:

Code: [Select]

ds.PacketRecords:=-1;
ds.Open;

lordoza

  • Newbie
  • Posts: 3
dbgrid scrollbars
« Reply #3 on: August 22, 2006, 08:06:22 am »
it works like a charm! thanks jesusr! :)
and... i have another question about dbgrid scrollbars is it posible to refresh view (records) when scrolling?

thanks!

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2584
dbgrid scrollbars
« Reply #4 on: August 23, 2006, 11:35:58 am »
Fetching all records is fine for small datasets, but be carefull when a query might return 1mil records.

Side note, some db implementations return the number of records a query will return, without fetching all records.
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018