Subject Re: begintrans()
From Mervyn Bick <invalid@invalid.invalid>
Date Tue, 6 Dec 2022 11:49:35 +0200
Newsgroups dbase.getting-started

On 2022/12/06 11:18, Mustansir Ghor wrote:
> However, Below text is copied from dbase help. Here why is the command form.rowset.parent.database.begintrans() and not form.database.begintrans()
> try
>     form.rowset.parent.database.beginTrans( ) // Begin the transaction
>     form.rowset.parent.database.commit( ) // If you got this far, there were no
> catch ( Exception e ) // The parameter receives the Exception object that describes
>     form.rowset.parent.database.rollback( ) // Undo any changes that did take
> endtry

Although it's not usual, a form may have more than one database object
and each database object may have more than one query (and as a result
more than one rowset) associated with it.

If you know which database associated with the query, and hence the
rowset you are working with, then by all means use

Although a form may have several rowsets in play only one can be
assigned to the form's rowset property.

Example code in the help file needs to be fairly universal.  In this
case the author is using the rowset assigned to the form's rowset
property.  He does not, therefore, need to name the query. By working
back up the "parentage" the author also specifies the correct database
without needing to know it's actual name.

If you need to work with a rowset not assigned to the form's rowset
property then you need to specify the rowset in the command if you don't
specify the actual database.

    form.customers1.rowset.parent.database.beginTrans( )