Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HELP! Why is VFPCOM's RSToCursor failing with a COM object?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
HELP! Why is VFPCOM's RSToCursor failing with a COM object?
Miscellaneous
Thread ID:
00462418
Message ID:
00462418
Views:
49
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
Next
Reply
Map
View

Click here to load this message in the networking platform