Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Requerying a grid control
Message
De
05/12/2005 12:35:48
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01074269
Message ID:
01074990
Vues:
25
>Ok, how do I refresh a cursor in my grid then?
>

Is it a SELECT ... INTO CURSOR ... cursor ?

If yes,
VFP is horrible for the in line SELECT-SQL in how much it doesn't store
the command SELECT-SQL in the cursor property "SQL" and then you cannot do a REQUERY().

With a CA you can build a workaround for execute the SELECT-SQL,
and after you can do a REQUERY() without the CA.

EXAMPLE:
CLEAR
CLOSE TABLES all

CREATE CURSOR byby (aa i)

* SELECT * FROM BYBY INTO CURSOR myCursor
* replaced with:
=CREATEOBJECT("RequerableCursor","SELECT*FROM BYBY","myCursor")

? RECCOUNT("myCursor")
APPEND BLANK IN BYBY
REQUERY("myCursor")
? RECCOUNT("myCursor")


DEFINE CLASS RequerableCursor as CursorAdapter
	DataSourceType	= "NATIVE"
	BreakOnError	= .T.

	PROCEDURE Init(cmd,alias)
		this.SelectCmd	= m.cmd
		this.Alias		= m.Alias
		CursorAdapter::CursorFill
		CursorAdapter::CursorDetach
		SELECT (m.Alias)
	ENDPROC
ENDDEFINE
>>You can only requery a view.
>>
>>>Ok Mike, thanks for that! I was being slow....
>>>
>>>However, i'm now getting "function is not available on native tables"
>>>
>>>The table in question is a cursor?
>>>
>>>whats wrong?
>>>
>>>
>>>>>Hi Jim
>>>>>
>>>>>Maybe its me being really slow, but where is the requery method you are talking about on a grid? I can gind it on a listbox but not on a grid control? Neither could I find it in the dataenviroment?
>>>>>
>>>>
>>>>It's not a method of the grid. The requery function is part of the VFP language. REQUERY("v_YourView")
>>>>
>>>>>
>>>>>
>>>>>>>Hi! I've recently got more into using SQL commands in my list boxes and grid controls.
>>>>>>>
>>>>>>>How do I requery the Row Source in my grid, like I do on a list box?
>>>>>>>
>>>>>>>Or should a refresh do the trick (doesnt seem to do?)
>>>>>>>
>>>>>>>Any help extremley appreciated
>>>>>>>
>>>>>>>TIA
>>>>>>
>>>>>>Robin,
>>>>>>
>>>>>>You would need to use the Requery() function to requery the view that your grid is using. You mat also need to refresh the grid itself after the requery of the view.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform