Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cursor Update?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00175778
Message ID:
00176233
Vues:
30
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform