Page 1 of 1

Problem with TBookmark

Posted: Mon 19 Jan 2009 19:35
by Peter Helfrich
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.

Posted: Tue 20 Jan 2009 09:39
by Dimon
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.