#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    28
    Rep Power
    0

    Bookmark is invalid...


    I'm working with the application which consists 6 modules,but except one module i receive the error 'Bookmark is invalid', while executing an application....,
    What would be the reason ?

    Thanks in advance...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    350
    Rep Power
    7
    Originally Posted by Murugavel
    I'm working with the application which consists 6 modules,but except one module i receive the error 'Bookmark is invalid', while executing an application....,
    What would be the reason ?

    Thanks in advance...
    Is it possible that the database record you have bookmarked has been deleted when you want to go back to it? Or other possibilities, you are filtering the dataset and the bookmarked record is not visible while filtered = true, you closed, then re-opened the dataset, or possibly even refreshed (someone else may have deleted the record in a multi-user environment).

    I do use bookmarks, but I always wrap them within try..try..except..finally blocks.

    Code:
    var
       bk: TBookMark;
    begin
       bk := Query1.GetBookMark;
       //allocates memory, so wrap in try..finally
       try
          //work with your dataset here
          try
             Query1.GotoBookMark(bk);
             //can cause error so wrap in try..except
          except
             //silences the error if bookmark is invalid
          end;
       finally
          Query1.FreeBookMark(bk);
       end;
    end;
    There is Query1.BookMarkValid(bk) that returns a boolean value, but it is unreliable in that it will return true even if the dataset cannot go to the bookmark for some of the reasons I gave above.

IMN logo majestic logo threadwatch logo seochat tools logo