Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Custom database event crashes VFP
Message
 
À
04/12/2003 10:24:37
Larry Long
ProgRes (Programming Resources)
Georgie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00855874
Message ID:
00855909
Vues:
13
And the cause is the field names in the testcrash: replace f1 to field1, f2 to field2, etc...

Also adding tables, like
ADD TABLE ('TEST_FLD_'+ALLTRIM(Structure2.field_name))
require they are NOT in use!

>VFP8 crashes when I use a custom dbc event and would very much appreciate either confirmation or feedback as to what I am doing wrong.
>
>To duplicate...
>1) Create a small free table...
>CREATE TESTCRASH (F1 C(10), F2 C(5), F3 C(20))
>
>2) Create a new database.
>
>3) Modify the AfterAddTable event to contain the code below...
>
>PROCEDURE dbc_AfterAddTable(cTableName, cLongTableName)
>*After table is successfully added to the DBC.
>LOCAL lcTableAlias, lcStructure1, lcStructure2, lcStructure3, lcStructure4, oDataSession,;
> nCurrentSession, cSafeSetting
> cSafeSetting = SET('SAFE')
> SET SAFETY OFF
>*!* *nCurrentSession = SET('DataSession')
>*!* *oDataSession = CREATEOBJECT('Session')
>*!* *SET DATASESSION TO (oDataSession.DATASESSIONID)
>
> STORE SYS(2015) TO lcTableAlias
> STORE SYS(2015) TO lcStructure1
> STORE SYS(2015) TO lcStructure2
> STORE SYS(2015) TO lcStructure3
> STORE SYS(2015) TO lcStructure4
>
>SELECT 0
>CREATE CURSOR fldstru1 ( ID i AUTOINC, USERID CHAR(25), changedate T, postdate T)
>
>SELECT fldstru1
>COPY STRUCTURE EXTENDED TO (lcStructure1)
>
>SELECT 0
>USE (lcStructure1) ALIAS Structure1
>
>COPY STRUCTURE TO (lcStructure3)
>
>USE (cLongTableName) IN 0 AGAIN SHARED NODATA NOUPDATE ALIAS (lcTableAlias)
>
>SELECT (lcTableAlias)
>
>COPY STRUCTURE EXTENDED TO (lcStructure2)
>
>SELECT 0
>USE (lcStructure2) ALIAS Structure2
>
>SCAN
> COPY NEXT 1 TO (lcStructure4)
>
> IF NOT USED('Structure3')
> USE (lcStructure3) IN 0 ALIAS Structure3 EXCLU
> ENDIF
> SELECT Structure3
> ZAP
>
> APPEND FROM (lcStructure1)
> APPEND FROM (lcStructure4)
>
> CREATE ('TEST_FLD_'+ALLTRIM(Structure2.field_name)) FROM (lcStructure3) DATABASE (cDBC)
> ADD TABLE ('TEST_FLD_'+ALLTRIM(Structure2.field_name))
>ENDSCAN
>
>USE IN SELECT('Structure1')
>USE IN SELECT('Structure2')
>USE IN SELECT('Structure3')
>USE IN SELECT('Structure4')
>
>USE IN SELECT(lcTableAlias)
>USE IN SELECT(lcStructure1)
>USE IN SELECT(lcStructure2)
>USE IN SELECT(lcStructure3)
>USE IN SELECT(lcStructure4)
>
>ERASE (lcTableAlias+'.*')
>ERASE (lcStructure1+'.*')
>ERASE (lcStructure2+'.*')
>ERASE (lcStructure3+'.*')
>ERASE (lcStructure4+'.*')
>
>SET SAFETY &cSafeSetting.
>*SET DATASESSION TO nCurrentSession
>ENDPROC
>
>4) Turn dbc events on.
>
>5) Add TESTCRASH.DBF to the DBC
>
>
>Any comments would be MOST appreciated.
>
>Thanks,
>Larry Long
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform