Occasionally you may need a temporary cursor to access tables. There are several ways to access the database via cursors. But the best way does not violate Dabo's 3 tier design and most importantly does not cause other issues with Dabo.

Below is an example of how I did it.


I add the following to the forms “createBizobjs()”


self.biztmp = dabo.biz.dBizobj(self.Connection)

self.tmpbiz = self.biztmp.getTempCursor()


Note:

self.Connection is the name of the Form's connection to the database. And I did not add the bizobj to the form (do not -> “self.addBizobj(self.biztmp)”)


Now I can use “self.tmpbiz” anywhere on the form as I would any other bizobj. So I can:

self.tmpbiz.execute(“select somefield from sometable”)

and the bizobj “self.tmpbiz” will contain the retreived data in the DataSet.


In my case I decided to create a special bizobj to make it easier to identify in code. But you could have used any bizobj that the form knows about. So if the form has a bizobj named “CustomerBizObj” you can use it to create a temporary cursor.


myTempCursor = self.Form.CustomerBizObj?.getTempCursor().


The above will not change/touch/overwrite the CustomerBizObj? data.