Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor Update?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00175778
Message ID:
00176233
Views:
29
>It seems like someone told me how to make a cursor created with select sql updatable. There was also a tip in FoxAdvisor explaining how index the same cursor as well but I can't seem to find it. Can someone give me a quick review?

Here's a couple of procedures I now use in FPW2.6 and VFP to simplify this. Bear in mind I always name SQL cursors with C_xxxxx and R/W cursors with R_xxxxx
************************************************
Procedure RWOpen
************************************************
* create a read/write cursor from the currently selected cursor
PARAMETER tAlias
cAlias= ALIAS()
SELECT 0
IF EMPTY(m.tAlias)
	* ASSERT m.cAlias = 'C_'
	tAlias= STRTRAN(m.cAlias, 'C_', 'T_')
ENDIF
USE DBF(m.cAlias) AGAIN ALIAS (m.tAlias) EXCLUSIVE
USE IN (m.cAlias)
RETURN DBF()

************************************************
Procedure RWClose
************************************************
PARAMETER cAlias
PRIVATE cDbf, oldSel
oldSel= SELECT()
IF ! EMPTY(m.cAlias)
	SELECT (m.cAlias)
ENDIF
cCdx= ForceExt(DBF(), 'CDX') && Foxtools
USE
ERASE (m.cCdx) && doesn't matter if it doesn't exist
SELECT (m.oldSel)
Note I explicitly remove the CDX file if one exists because I *know* doesn't Fox always delete it automatically.

HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform