Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HELP! Why is VFPCOM's RSToCursor failing with a COM obje
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00462418
Message ID:
00463085
Views:
19
Hi John,

I made some tests and got the same results. Don't know why it is not working with DLL, but when I compiled it as out-of-process EXE it worked.



>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
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform