Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
? No longer works as parameters in VFP9
Message
De
29/12/2004 06:17:34
 
 
À
29/12/2004 05:42:57
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
DB2
Divers
Thread ID:
00972845
Message ID:
00972877
Vues:
13
Hi,

Hmm well I can't get it to work in VFP9 I get the error: "ADODB.Parameters : Item cannot be found in the collection corresponding to the requested name or ordinal." When CursorFill Executes. Its very reproducable. Any code I run in this manner with fieldname=?Value as parameters gives the message.

Would you mind posting the code u use that works?

Again : This code runs ok in VFP8 but gives the above error in VFP9.
PUBLIC oConnection AS ADODB.Connection

**Provider=IBMDADB2.1;Password=db2admin;User ID=db2admin;Data Source=PDM;Persist Security Info=True
**Provider=MSDAORA.1;Password=runtime;User ID=sysadm;Data Source=TJM;Persist Security Info=True
**Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=men;Data Source=TJM
**Provider=VFPOLEDB.1;Data Source=C:\COMPANY\soliver\data men;Password="";Collating Sequence=MACHINE

oConnection = CreateObject("adodb.connection")
with oConnection
	.Provider = "IBMDADB2.1"
	.ConnectionString = "Password=db2admin;User ID=db2admin;Data Source=DBTJM"
	.Open
endwith

SET STEP ON
**OK
FetchCursor("select * from shared.users","users")

**Not OK
lcUserName="DB2ADMIN"
lnUserno=4
FetchCursor("select * from shared.users where username=?lcUserName and userno=?lnUserno","users")

*************************************************************************************
FUNCTION FetchCursor
LPARAMETERS lcSQL,lcCursorName,lEditable,lShowErrors,lAsync
LOCAL loCursor as CursorAdapter
LOCAL loRecordSet As adodb.recordset
LOCAL loCommand As adodb.command
LOCAL llok
	
	IF PCOUNT()=2
		lEditable=.F.
		lShowErrors=.T.
		lAsync=.T.
	ENDIF
	
	IF USED(lcCursorName)
		USE IN (lcCursorName)
	ENDIF
	
	loRecordSet = CREATEOBJECT("adodb.recordset")
	loCommand = CREATEOBJECT("adodb.Command")
	
	WITH loCommand
		.activeconnection=oConnection
		.commandtext=lcSQL
	ENDWITH

	IF !lEditable
		loRecordSet.CursorType= 0  && adOpenForwardOnly
		loRecordSet.LockType= 1  && adLockReadOnly
	ELSE
		loRecordSet.CursorType= 3  && adOpenStatic
		loRecordSet.LockType= 3  && adLockOptimistic
	ENDIF

	loCursor = CREATEOBJECT('CURSORADAPTER')
	
	loCursor.Alias=lcCursorName
	loCursor.DataSourceType="ADO"
	loCursor.DATASOURCE = loRecordSet
	loCursor.SELECTCMD = lcSQL
    loCursor.DATASOURCE.ACTIVECONNECTION = oConnection
	
	IF lAsync
		lnOptions=0x00000020	&&ADRUNASYNC
	ELSE
		lnOptions=0
	ENDIF
	
	llok=.T.
	IF "?"$lcSQL	&&Parameters in the SQL
		IF !loCursor.CURSORFILL(.F., .F., lnOptions, loCommand)
	       IF lShowErrors
	       	 AERROR(laErrors)
	         MESSAGEBOX(laErrors[2],0+16,"QuestPDM - FetchCursor")
	       	 _CLIPTEXT=MESSAGE()
	       ENDIF  
	       llok=.F.
	    ENDIF
	ELSE
		IF !loCursor.CURSORFILL(.F.,.F.,lnOptions,)
	       IF lShowErrors
	       	 AERROR(laErrors)
	         MESSAGEBOX(laErrors[2],0+16,"QuestPDM - FetchCursor")
	       ENDIF  
	       llok=.F.
	    ENDIF
	ENDIF
	
	IF !lEditable AND llok
		loCursor.CursorDetach()
	ENDIF
	 
RETURN loCursor.cursorstatus
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform