Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to store a VFP object in a table?
Message
De
03/12/2007 16:52:14
Mike Sue-Ping
Cambridge, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Divers
Thread ID:
01272898
Message ID:
01272932
Vues:
20
>Hi,
>
>>Does anyone know if it is possible to store an object (based on the empty class) into a table or cursor? If so what field type? If not, any suggestions?
>
>The quickest way is most times to transfer all properties to variables and then use SAVE MEMORY.
>
>*========================================================================================
>* Converts an object based on EMPTY to a string.
>*========================================================================================
>Lparameters toObject
>
>	Local lnIndex, lcVariable, laPEM[1], lcName
>	For m.lnIndex=1 to AMembers(laPEM,m.toObject)
>		lcName = laPEM[m.lnIndex]
>		lcVariable = "__pem_" + m.lcName
>		If Type("Alen(m.toObject."+m.lcName+")") == "N"
>			If Alen(m.toObject.&lcName,2) == 0
>				Local (m.lcVariable+"[Alen(m.toObject."+m.lcName+",1)]")
>			Else
>				Local (m.lcVariable+"[Alen(m.toObject."+m.lcName+",1),Alen(m.toObject."+m.lcName+",2)]")
>			EndIf
>			Acopy( m.toObject.&lcName, &lcVariable )
>		Else
>			Local (m.lcVariable)
>			Store GetPem(m.toObject,m.lcName) to (m.lcVariable)
>		EndIf
>	EndFor
>
>	Local lcData
>	If Used("curMemo")
>		Select curMemo
>	Else
>		Create Cursor curMemo (cMemo M)
>		Append Blank
>	EndIf
>	Save to memo cMemo all like __pem_*
>	lcData = cMemo
>	
>Return cMemo
>
Hey Christof,

I've got to admit, Save to and Restore from are "ancient" and I've not used those commands for ages. Thanks for the code sample. I can make that work for me.

Regards,

Mike
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform