Mr James
METHOD Close() is the same from 13.03 till 17.07 (without fix)
oStates := TDataBase():Open( nil, "STATES" )
? oStates:nArea, oStates:Code, oStates:Name // 1, "WA", "Washington"
USE CUSTOMER // By mistake
oStates:GoTop()
? oStates:nArea, oStates:Code, oStates:Name // 1, "Homer", "Simpson"
We also noticed another issue with METHOD Use(). Multiple calls to Use() when the object is already open, result in orphaning the present alias/area and opening the same dbf in a new area/alias. This is also fixed in 17.08. Second and subsequent calls are ignored. With all these modifications, it is now possible to reopen dbf by calling Use() after closing with Close().
oStates := TDataBase():Open( nil, "c:\fwh\samples\states.dbf", "DBFCDX", .t. )
oStatesAlt := TDataBase():Open( nil, "c:\fwh\samples\states.dbf", "DBFCDX", .t. )
oStates := TDataBase():Open( nil, "c:\fwh\samples\states.dbf", "DBFCDX", .t. )
oStatesAlt := TDataBase():Open( nil, "c:\fwh\samples\states.dbf", "DBFCDX", .t. )
#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oStates
oStates := TDataBase():Open( nil, "STATES", "DBFCDX", .t. )
? oStates:nArea, oStates:cAlias // --> 1, "TDF"
oStates:Use() // Called when oStates is already open
? oStates:nArea, oStates:cAlias // --> 2, "TDF001"
oStates:Close() // Closes Area 2 Alias "TDF001"
// oStates is not aware that Area 1 (Alias TDF) is still open
// Even we do not know
// This remains open like this till the application is closed.
// If we now try to open STATES.DBF exclusively, the call fails.
return nil
With all these modifications, it is now possible to reopen dbf by calling Use() after closing with Close().
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 39 guests