Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HELP! Why is VFPCOM's RSToCursor failing with a COM object?
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
HELP! Why is VFPCOM's RSToCursor failing with a COM object?
Divers
Thread ID:
00462418
Message ID:
00462418
Vues:
47
When I use the VFPCOM utilities RSToCursor(), it works fine EXCEPT when the RecordSet object is in a COM object. I suspect I am missing something basic - so any help will be MOST appreciated!

This code snippet works - just save to a prg and run.
o = createobject('oTest')
o.makeRS()
oComUtil = create("vfpcom.comutil")
oComUtil.RSToCursor(o.oRS,'TestCursor') && The cursor is created
brow norm

DEFINE CLASS oTest AS custom 
	oRS = NULL
	FUNCTION makeRS
		create cursor cTest (FieldOne c(10))
		insert into cTest (fieldone) values ('One')
		insert into cTest (fieldone) values ('Two')
		insert into cTest (fieldone) values ('Three')
		this.oRS = CreateObject("ADODB.Recordset")

		oComUtilClass = create("vfpcom.comutil")
		oComUtilClass.CursorToRS(this.oRS)
		use in cTest
		RETURN
	ENDFUNC
ENDDEFINE
This example does NOT work. First, save this class to a prg, add the prg to a project, and create the project as a DLL called, eg, 'RSdata'
DEFINE CLASS oTest AS custom OLEPUBLIC
	oRS = NULL
	FUNCTION makeRS
		create cursor cTest (FieldOne c(10))
		insert into cTest (fieldone) values ('One')
		insert into cTest (fieldone) values ('Two')
		insert into cTest (fieldone) values ('Three')
		this.oRS = CreateObject("ADODB.Recordset")

		oComUtilClass = create("vfpcom.comutil")
		oComUtilClass.CursorToRS(this.oRS)
		use in cTest
		RETURN
	ENDFUNC
ENDDEFINE
Then, run the next lines from the command window or a prg
clear all
oComUtil = create("vfpcom.comutil")
o = createobject('Rsdata.oTest')
o.makeRS()  && The o.oRS object is a valid RecordSet object, but...
oComUtil.RSToCursor(o.oRS,'TestCursor') && No cursor is created
brow norm  && no cursor is open
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform