Problem with TBookmark

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Peter Helfrich
Posts: 2
Joined: Sat 06 Dec 2008 09:37

Problem with TBookmark

Post by Peter Helfrich » Mon 19 Jan 2009 19:35

Hello,

I'm using MyDAC 5 pro with Delphi7.
There is a Problem with TBookmark. It doesn't works after changing "Orderfiels".
I allway get the same RecNo??? (but my Record is an other one)

Code: Select all

procedure TForm1.Button1Click(Sender: TObject);
var BM: TBookmark;
begin

  With MyTable1 Do Begin

    BM:= GetBookmark;
    ShowMessage(IntToStr(RecNo));    

    OrderFields:= 'Formel';

    GotoBookmark(BM);
    FreeBookmark(BM);

    ShowMessage(IntToStr(RecNo));    

  end;

end;
Thank you for help.

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

Post by Dimon » Tue 20 Jan 2009 09:39

This behaviour is peculiarity of work with TBookmark.
The point is that setting of the OrderFields property establishes server sorting and a query is reopened. In this case GotoBookmark is based on RecNo.
To solve this problem you should use the IndexFieldNames property to establish local sorting.

Post Reply