CRDBGrid SelectAll

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
deca
Posts: 19
Joined: Thu 05 Apr 2007 13:36
Location: Germany

CRDBGrid SelectAll

Post by deca » Mon 26 May 2008 09:49

Hi,

I use the CRDBGrid in many of our application, and I'm very happy with them.

Theres just one problem with selecting rows.

When you want to select all records there is no method for it.

So I handle "CTRL+A" to execute following code:

Code: Select all

    MyQry.First;
    while not MyQry.Eof do
    begin
      Grid.SelectedRows.CurrentRowSelected := true;
      MyQry.Next;
    end;
If you have only a small count of rows this work pretty good, but if you have greater tables, as it is in the most of our projects, the method case to scroll down the complete table and handle each row.

So in a normal project of us I counted such a selectall of 20sec for just about 7000 rows, wich is definitely to long.

May you can me provide a better solution or integrate a selectall method in the CRDBGrid?

I'm using:
Delphi 7.0 with MyDac 5.50.0.34

Best regards,
Karsten Hansske

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 27 May 2008 09:06

In order to solve this problem, you can use the following code:

Code: Select all

    Grid.Hide;
    try
      MyQry.First; 
      while not MyQry.Eof do 
      begin 
          Grid.SelectedRows.CurrentRowSelected := true; 
          MyQry.Next; 
      end; 
    finally
      Grid.Show;
    end;

deca
Posts: 19
Joined: Thu 05 Apr 2007 13:36
Location: Germany

Post by deca » Tue 27 May 2008 09:15

But this is exactly what we are doing. This is working with a small count of records. But with greater tables it's really slow. So we need another kind of solution. Do you have any other?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 28 May 2008 09:44

deca wrote:But this is exactly what we are doing.
Note, I use the Grid.Hide and Grid.Show methods, which speed up execution. It should work quickly.

deca
Posts: 19
Joined: Thu 05 Apr 2007 13:36
Location: Germany

Post by deca » Fri 25 Jul 2008 14:30

Yes, the speed is faster while hiding the grid. But there is no other function to select directly all records?

Post Reply