Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HELP! Why is VFPCOM's RSToCursor failing with a COM obje
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00462418
Message ID:
00463305
Vues:
17
It seems that the client should be responsible for the cursor. Just a hunch. Have checked out the ADO Query Analyzer in files (COM/DCOM OLE Automation). It has a simple ADO COM, the client references and structures the recordset, the COM (dll) just makes it (RecordSet) available.

>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
Imagination is more important than knowledge
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform