Visual InterDev

getBookmark Method

See Also      Applies To

Returns a bookmark for the current record.

Syntax

object.getBookmark()

Parameters

object

A script object.

Remarks

To set the bookmark, use the setBookmark method.

The getBookmark and setBookmark methods are similar to ADO recordset bookmarks, but can be persisted between pages.

Because the default behavior when binding to data in ASP requires your code to Close and Reopen the recordsets each time the page is served, and because ADO bookmarks are invalid once the recordset is closed, Microsoft® Visual InterDev™ implements a custom bookmark, that behaves just like an ADO bookmark.

Thus, you can store a bookmark, close the recordset, re-open the recordset and set the bookmark and you will be at the correct record.

Example

The following script stores a bookmark, closes the recordset, re-opens the recordset, and sets the bookmark so that you will be at the correct record.

Sub SampleBookmark()
dim tmpBookMark
   myRS.Open()
   myRS.moveNext() ' now we are on the second record
   tmpBookMark = myRS.getBookMark()
   'now close the recordset
   myRS.Close()
   'typically your bookmark is invalid, but in Visual InterDev it is not
   'we will re-open this recordset, but assume this is another page perhaps
   myRS.Open()
   'let's also assume that several records have been inserted before 
   'and after the record we bookmarked
   myRS.setBookMark(tmpBookMark)
   'we are now on the same record we were before (which this time is not necessarily the 2nd record)
   
End Sub