General information
Category:
Forms & Form designer
Finally getting back to this. This may be a dumb question but I wan to be sure I do right. Since application already used a public variable for the folder in which the tables reside can I use it in the forms data environment method?
>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')
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only