Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Changing the DBC and reloading a form
I have a form based on a class. When it loads, the beforeopentables database event calls the following method:
PRIVATE ALL LIKE l_*
SET TALK OFF
SET EXCL OFF
IF TYPE( 'oApp' ) = 'O'
l_cdata = SYS(5) + CURDIR() + oapp.cdatabase + '.dbc'
ELSE
l_cdata = SYS(5) + CURDIR() + 'data_testdata\wedding.dbc'
ENDIF
SET DATA TO ( l_cdata )
l_lOk = .T.
l_nx = 0
DO WHILE l_lOk
l_nx = l_nx + 1
l_cObject = 'thisform.dataenvironment.cursor' + TRANSF( l_nx )
IF TYPE ( l_cObject ) = 'O'
WITH &l_cObject
IF NOT ( 'common' $ LOWER( .DATABASE ) )
.DATABASE = l_cdata
ENDIF
ENDWITH
ELSE
l_lOk = .F.
ENDIF
ENDDO
This will set all the cursors in the DE to the proper database. When I actually get the form open I can see that indeed the proper tables have been opened.
However, if I have loaded the form multiple times and switched the databases in between, when I requery the views for the form, the views are pointing to a previous DBC.
The paths are set correctly, and the DBC() is set correctly. I know there is an issue with VFP caching objects, but I don't know if this has anything to do with my symptoms. I believe from time to time, this code has worked for me.
Anyone have suggestions?
Thanks.
Dave
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement