Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RI Delete Restrict not Working?
Message
 
 
À
31/01/2009 18:43:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01378619
Message ID:
01378637
Vues:
14
It looks like the Tableupdate() happens on Close and only then the error occurs.

>I have my RI set to restrict delete rules for a child table. My maintenance form lets me delete the parent record with child records linked to it, until I try to close my form. Then I get a trigger failed error. I must be accidently overriding some default behavior? Do I need to set other properties in my business object to make with work correctly?
>I am using MM framework, VFP SP2 on Vista.
>Here is the RI code section:
>
>SELECT (lcParentWkArea)
>pcParentDBF=dbf()
>pnParentRec=recno()
>STORE CID TO lcParentID,pcParentID
>pcParentExpr="CID"
>lcChildWkArea=riopen("users","cgroupid")
>IF lcChildWkArea<=0
>  IF _triggerlevel=1
>    DO riend WITH .F.
>  ENDIF at the end of the highest trigger level
>  RETURN .F.
>ENDIF not able to open the child work area
>pcChildDBF=dbf(lcChildWkArea)
>llRetVal=!SEEK(lcParentID,lcChildWkArea)
>SELECT (lcChildWkArea)
>pnChildRec=recno()
>pcChildID=CGROUPID
>pcChildExpr="CGROUPID"
>IF !llRetVal
>  pnError = rierror(-1,"Delete restrict rule violated.","","")
>ENDIF
>=rireuse("users",lcChildWkArea)
>IF NOT llRetVal
>  IF _triggerlevel=1
>    DO riend WITH llRetVal
>  ENDIF at the end of the highest trigger level
>  SELECT (lcStartArea)
>  RETURN llRetVal
>ENDIF
>IF _triggerlevel=1
>  do riend with llRetVal
>ENDIF at the end of the highest trigger level
>SELECT (lcStartArea)
>RETURN llRetVal
>** "End of Referential integrity Delete trigger for" user_group
>
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform