Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index Error on Cursor
Message
De
15/07/2005 12:12:44
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Index Error on Cursor
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Divers
Thread ID:
01033065
Message ID:
01033065
Vues:
72
hello everybody.

ok, i got a problem here i can't figure out. i get an error on the index command "File must be opened exclusive".

here is the code, can anyone see what i am doing wrong?
		IF USED("q_Pn_InvLoc")
			SELE q_Pn_InvLoc
			CLOSE INDEXES
			USE IN q_Pn_InvLoc
		ENDIF

		IF IsBlank(m.FromWhse)
			WAIT WIND "Collecting all parts in warehouses, please wait..." NOWAIT
			QuerryFlt = ".t."
			FromStr = ;
				"invloc q_a"
		ELSE
			WAIT WIND "Collecting all parts in warehouse " +m.FromWhse+ ", please wait..." NOWAIT
			QuerryFlt = "q_a.whse = m.FromWhse"
			FromStr = ;
				"invloc q_a"
		ENDIF

		SELE ;
			q_a.* ;
			FROM &FromStr ;
			WHERE &QuerryFlt ;
			INTO CURSOR q_Temp_Pn_InvLoc

		oToolBox.oLocalSQL.MakeCursorReadWrite("q_Temp_Pn_InvLoc", "q_Pn_InvLoc", , 'excl')
		SELE q_Pn_InvLoc
		INDEX ON pn TAG pn ADDI       && error here
		INDEX ON pn+opt1+opt2+opt3+opt4+opt5+opt6+opt7+opt8+whse TAG pn3 ADDI  && error here
		SET ORDER TO pn3

procedure oToolBox.oLocalSQL.MakeCursorReadWrite
LPARA ;
	cSourceCursor, ;
	cTargetCursor, ;
	nDS, ;
	cUserType
LOCAL ;
	OldSelect, ;
	ReturnValue, ;
	nCurrDS

* *** **********************************************************************************
* *** this method will make out of a read-only cursor a read/write cursor
* *** cSourceCursor -> alias from read-only cursor
* *** cTargetCursor -> optional
* ***                  if passed, the passed alias name is used to create the
* ***                  read/write cursor. if not passed the original alias name is
* ***                  used to create it.
* *** returned is the new cursor alias name
* *** **********************************************************************************

ReturnValue = ""

nCurrDS = SET("DataSession")
IF TYPE("m.nDS") = "N" .AND. m.nDS <> m.nCurrDS
	SET DATASESSION TO (m.nDS)
ENDIF

IF USED(m.cSourceCursor)
	OldSelect = SELECT()
	IF TYPE("m.cTargetCursor") <> "C" .OR. IsBlank(m.cTargetCursor)
		cTargetCursor = m.cSourceCursor
	ENDIF
	ReturnValue = m.cTargetCursor

	SELE 0
	IF UPPER(ALLT(m.cTargetCursor)) = UPPER(ALLT(m.cSourceCursor))
		USE DBF(m.cSourceCursor) ALIAS cur_ReadWrite_Temp AGAIN
		USE IN (m.cSourceCursor)
		SELE 0
		if Type("m.cUserType") = "C" .and. upper(m.cUserType) = "EXCL"
			USE DBF("cur_ReadWrite_Temp") ALIAS (m.cTargetCursor) AGAIN excl
		else
			USE DBF("cur_ReadWrite_Temp") ALIAS (m.cTargetCursor) AGAIN
		endif
		USE IN cur_ReadWrite_Temp
	ELSE
		if Type("m.cUserType") = "C" .and. upper(m.cUserType) = "EXCL"
			USE DBF(m.cSourceCursor) ALIAS (m.cTargetCursor) AGAIN excl
		else
			USE DBF(m.cSourceCursor) ALIAS (m.cTargetCursor) AGAIN
		endif
		USE IN (m.cSourceCursor)
	ENDIF

	SELECT(m.OldSelect)
ENDIF

IF TYPE("m.nDS") = "N" .AND. m.nDS <> m.nCurrDS
	SET DATASESSION TO (m.nCurrDS)
ENDIF
RETURN(m.ReturnValue)
endprocedure
thank for any help you can provide in advance!
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform