Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning Cursors...
Message
 
 
À
29/08/2002 15:24:50
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00695065
Message ID:
00695138
Vues:
16
Pablo,
You seem to have misunderstood Craig. You can not access datasessions from different VFP instances. When you create a VFP COM object, you are in effect opening another instance of VFP. The two instances share nothing (e.g. variables, datasessions, etc.). The only way to get information back and forth is to pass that information explicitly or have it reside outside of both instances (e.g some file sitting on the hard drive).

The code below simply chnages datasessions within its own instance. It does not access anything outside of it.

HTH.

>SO this should work for what I need? I did so, and nothing happened... any suggestions, or am I wrong?
>
>
>FUNCTION G2_EstoqToCursor(cCursor AS String) ;
>		HELPSTRING [Esta função consulta estoque de um produto em uma determinada loja, e cria um cursor com o nome especificado.]		
>		*-- Queries the stock and creates a cursor.
>		
>		LOCAL sbkMultiLocks,sbkReprocess
>		
>		IF EMPTY(This.Codigo)
>			COMRETURNERROR([ComEstoque],[Can't search with empty Codigo.])
>			RETURN .F.
>		ENDIF
>		
>		IF EMPTY(This.Loja)
>			COMRETURNERROR([ComEstoque],[Can't search product in empty Loja.])
>			RETURN .F.
>		ENDIF
>		
>		IF VARTYPE(cCursor) <> [C]
>			COMRETURNERROR([ComEstoque],[Cursor name is empty or invalid])
>			RETURN .F.
>		ENDIF
>		
>		SET DATASESSION TO 1
>		
>		sbkMultiLocks = SET("Multilocks")
>		sbkReprocess  = SET("Reprocess")
>		
>		SET MULTILOCKS on
>		SET REPROCESS TO 5 seconds
>						
>		This.AbreArquivos() && open tables on current datasession
>		
>		SELECT							  					 ;
>			g2_estoq.custo_med								,;
>			g2_estoq.ant_inv								,;
>			g2_estoq.dat_custo								,;
>			g2_estoq.dat_est								,;
>			g2_estoq.dat_inv								,;
>			g2_estoq.datultcomp								,;
>			g2_estoq.dia_giro								,;
>			g2_estoq.local									,;
>			g2_estoq.pccompsicm								,;
>			g2_estoq.qtd_est								,;
>			g2_estoq.qtd_giro								,;
>			g2_estoq.qtd_inv								,;
>			g2_estoq.qtd_max								,;
>			g2_estoq.qtd_min								,;
>			g2_estoq.valultcomp								 ;
>		FROM 												 ;
>			g2_estoq										 ;
>		WHERE 												 ;
>			g2_estoq.codigo == This.Codigo					 ;
>			AND												 ;
>			g2_estoq.loja   == This.Loja					 ;
>		INTO CURSOR 										 ;
>			(cCursor)
>		
>		This.FechaArquivos() && Close tables opened by This.AbreArquivos()
>		
>		SET MULTILOCKS   &sbkMultiLocks
>		SET REPROCESS TO sbkReprocess
>					
>		SET DATASESSION TO This.DataSessionId
>
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform