Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Another wierd one
Message
From
08/03/2001 04:06:54
 
 
To
08/03/2001 03:49:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00482754
Message ID:
00483053
Views:
12
Ok, I see. Here's what I'm using in my grid's base class:
*-- grid.Init()
*-- open cursor in Read-Write mode so that we can add index tags
=CursWrit(This.RecordSource)

*  Program...........: CURSWRIT.PRG
*) Description.......: Re-opens a CURSOR created with SQL in read-write mode.
*)                   : RETURNs .t. if successful
*  Calling Samples...:
*  Parameter List....: tcAlias - optional CURSOR ALIAS
*  Major change list.:
*--------------------------------------------------------------------------------------------------
LPARAMETER tcAlias

*-- check parameter. If omitted, default to currently selected ALIAS()
IF TYPE("tcAlias") <> "C" OR EMPTY(tcAlias)
	tcAlias = ALIAS()
ENDIF

IF USED(tcAlias)

	SELECT (tcAlias)

	LOCAL lcDbf

	lcDbf       = DBF()                         && get handle to CURSOR
	lcTempAlias = "A" + SYS(3)                  && temp name
	
	USE (lcDbf) AGAIN IN 0 ALIAS (lcTempAlias)  && open temp cursor in read-write mode
	USE (lcDbf) AGAIN ALIAS (tcAlias)           && re-open CURSOR with original ALIAS

	USE IN (lcTempAlias)                        && close temp cursor
	RETURN .t.
ELSE
	*-- ALIAS not in use
	RETURN .f.
ENDIF
>>Will,
>>Stupid question, but why do you need a file presence? As mentioned by someone else, you can always make the cursor Read/Write if you need to modify it after the SQL SELECT. If you really need a file, then use INTO TABLE. Of course this has the disadvantage that you need to do the house keeping yourself.
>>HTH
>
>This is actually going into a grid baseclass - click on the column header and sort on that column.
>Problem is - If I try and index on a cursor with no disk presence my VFP hangs.
>I would really like to find a way to do this generically as otherwise I will have to go through all my forms which use grids and modify the select statements to use "into table" and then clean up after themselves.
>
>Excerpt from Hackers Guide :
>
>However, in some situations, especially those where the query result is then used in a subsequent query or where you want to index the cursor, having only a filtered view of the original causes problems. In VFP 3 and earlier versions, you worked around this by putting something in the query that outwitted FoxPro. Starting in VFP 5, it's a lot easier—just add NOFILTER to the query and FoxPro always creates a real cursor.
>
>
>I'm stuck :-(
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform