Recent

Author Topic: Dbgrid limit  (Read 410 times)

flori

  • Full Member
  • ***
  • Posts: 185
Dbgrid limit
« on: February 24, 2021, 02:17:35 pm »
Hi everyone!
I have a small demo program.
Does anyone know how to limit the number of rows in dbgrid?  I don’t want the user to have unlimited use of ...
Thank you

GetMem

  • Hero Member
  • *****
  • Posts: 3355
Re: Dbgrid limit
« Reply #1 on: February 24, 2021, 02:39:45 pm »
Hi everyone!
I have a small demo program.
Does anyone know how to limit the number of rows in dbgrid?  I don’t want the user to have unlimited use of ...
Thank you
Method 1:
Change sql text from:
Code: MySQL  [Select][+][-]
  1. select * from soil
to
Code: MySQL  [Select][+][-]
  1. select FIRST 100 * from soil

Method2:
Set SQLQuery Filtered property to true, then create an OnFilterRecord:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.SQLQuery1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
  2. begin
  3.   Accept := DataSet.FieldByName('ID').AsInteger < 100;
  4. end;
  5.  

flori

  • Full Member
  • ***
  • Posts: 185
Re: Dbgrid limit
« Reply #2 on: February 24, 2021, 03:08:21 pm »
thank you :)

 

TinyPortal © 2005-2018