>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