Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Objects getting clobbered - scope problem?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00913041
Message ID:
00913063
Vues:
15
Hi Michel,

Add LOCAL oRec to any of functions (better to both) and oRec wouldn't overwrittem anymore.

>Hi, Serge:
>
>Try it while passing a parameter:
>
>oRec = Null
>=f1()
>RETURN
>
>FUNCTION f1
>*LOCAL oRec
>CREATE CURSOR testxx1 (ii1 int, cc1 char(2))
>INSERT INTO testxx1  VALUES(1, "#1")
>SCATTER NAME oRec
>? oRec.ii1, oRec.cc1
>=f2(oRec.cc1)
>? oRec.ii1, oRec.cc1     && oRec object wasn't changed after call to f2()
>RETURN
>
>FUNCTION f2
>LPARAMETERS cc1
>CREATE CURSOR testxx2 (ii1 int, cc1 char(2))
>INSERT INTO testxx2  VALUES(2, "#2")
>SCATTER NAME oRec
>RETURN
>
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform