Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
When insert from name inserts blanks - gotcha
Message
 
 
À
18/12/2009 20:26:02
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01439900
Message ID:
01439951
Vues:
102
Another side effect is converting date properties into datetime.
CLEAR
oCol = CREATEOBJECT("Collection")
oItem = CREATEOBJECT("Empty")
ADDPROPERTY(oItem, "dDate", DATE())

? oItem.dDate, VARTYPE(oItem.dDate)

oCOl.Add(oItem)

FOR EACH loOneItem IN oCol
	? loOneItem.dDate, VARTYPE(loOneItem.dDate)
ENDFOR
>I have a collection of objects. All objects have the same properties, and each one is created as a kind of log entry in a long process. At the end of the process, I wanted to create a cursor and fill it from these objects, like this:
>
>
for each oObj in oCollection
>    insert into mycursor from name oObj
>endfor
>
>The trouble is, all records came up blank. When I inserted from one of the objects I created manually, it worked.
>
>What fixed this? for each oObj in oCollection FOXOBJECT. Because the oObj we get without it is a COM object somehow, and while the debugger shows its properties alright, Intellisense doesn't pick them and insert from name doesn't work. There may be other gotchas with this kind of object reference - just reporting that I caught this one.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform