wwWebPage::RegisterCursor

Adds a cursor to the list of open cursors that should be automatically closed when the page Dispose() fires.

When using cursors it's common to run a query early in the page cycle and then databind the cursor say to a DataGrid. Since databinding occurs during the Render() phase there's really no clean way to close the cursor in a linear fashion. The only option you have is to explicitly implement a Dispose() method and close the cursor in this method.

RegisterCursor() automates this process by allowing you to procedurally add a cursor as soon as it's been loaded. Internally the page keeps track of the specified cursors and then closes them all in the .Dispose() method of the page ensuring that the cursors are closed.

oCustomer = CREATEOBJECT("busCustomer")
lnCount = oCustomer.GetCustomerList("TEntries")

*** Register cursor to be closed
<<b>>THIS.Page.RegisterCursor("TEntries")<</b>>

*** Do whatever you need to do with the cursor
this.lstCustomers.DataSource = "TEntries"
this.lstCustomer.DataBind()
o.RegisterCursor(lcCursorName)

Parameters

lcCursorName
The Alias of an open cursor that should be closed when the page is done.


See also:

Class wwWebPage

© West Wind Technologies, 1996-2018 • Updated: 09/21/08
Comment or report problem with topic