Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to store a VFP object in a table?
Message
 
À
03/12/2007 16:05:19
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:
01272917
Vues:
19
This message has been marked as the solution to the initial question of the thread.
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 
--
Christof
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform