Information générale
Catégorie:
Gestionnaire d'écran & Écrans
The follow is my solution
design form normally, drag table/views to data environment
then set property you want.
Set the AutoOpenTable and AutoCloseTable of the dte to .f. .
in the load event of the form, write your own code to
enumerate cursors and its definition then construct codes
to open them in your ways.
the following is my code in load events
*-----------------------------------------------------------
PRIVATE o,oData,i,cOErr,lErr
lErr=.f.
cOErr=ON('error')
oData=thisform.dataEnvironment
FOR i=1 TO oData.objects.count
o=EVALUATE('oData.Cursor'+ALLTRIM(STR(i,3)))
ON ERROR lErr=.t.
IF ! DBUSED(o.database)
OPEN DATABASE (o.database) SHARED
ENDIF
SET DATABASE TO (o.database)
ON ERROR &cOErr
IF lErr
RETURN .f.
ENDIF
DO CASE
CASE o.bufferModeOverride=0
nBuffer=1
CASE o.bufferModeOverride=1
nBuffer=thisform.BufferMode+1
OTHERWISE
nBuffer=o.bufferModeOverride
ENDCASE
TEXT TO cTmp noshow
USE <> <>
in 0 ALIAS <> <>
<> <>
connstring (gcConnectString)
ENDTEXT
ctmp=chrTRAN(ctmp,CHR(13)+CHR(10)+CHR(9),' ')
ON ERROR lErr=.t.
&cTmp
ON ERROR &cOErr
IF lErr
RETURN .f.
ENDIF
ON ERROR lErr=.t.
CURSORSETPROP("Buffering",nBuffer,o.Alias)
ON ERROR &cOErr
IF lErr
RETURN .f.
ENDIF
ON ERROR lErr=.t.
IF NOT EMPTY(o.filter)
SET FILTER TO (o.filter) IN (o.alias)
ENDIF
ON ERROR &cOErr
IF lErr
RETURN .f.
ENDIF
NEXT
*---------
select (thisform.cMasterAlias)
this.nConnectHandle=CursorGetProp('ConnectHandle')
glSql(this.nConnectHandle,'set Lock_TimeOut 3000')
glSql(this.nConnectHandle,'SET DATEFORMAT ymd')
glSql(this.nConnectHandle,'SET ANSI_NULLS OFF')
Précédent
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