Code: Select all | Expand
METHOD New( ncArea, cFile, cDriver, lShared, lReadOnly, cPassword )
METHOD Open( cAlias, cFile, cDriver, lShared, lReadOnly, cPassword )
Code: Select all | Expand
METHOD New( ncArea, cFile, cDriver, lShared, lReadOnly, cPassword )
METHOD Open( cAlias, cFile, cDriver, lShared, lReadOnly, cPassword )
I noticed this because in the file where I use to open the tables sometimes I use Open and sometimes I use New, however there is always the USE command examplecnavarro wrote: Mon Mar 10, 2025 11:30 pm Dear Silvio
Both methods return Self, so they allow you to create a TDatabase object
If you use New(), and the database is not open, you will have to call the Activate method that opens the file (this method call the Use() method that opens the table)
If you use Open(), it means that the table is not open, so the Open method performs the same functions as New and Activate together
I hope this helps
Code: Select all | Expand
CLASS TXData from TDatabase
DATA cDbfPath init ".\DATA\"
ENDCLASS
CLASS TCust from TXData
METHOD New()
ENDCLASS
METHOD New( lShared ) CLASS TCust
Default lShared := .t.
::super:New(,::cDbfPath + "customers" ,"DBFCDX", lShared)
if ::use()
::setOrder(1)
::gotop()
endif
RETURN Self