local loVFPCOM >>loVFPCOM = create('vfpcom.comutil') >> >>create cursor worksok (charfield C(10), intfield I) >>insert into worksok values ('One', 1) >>insert into worksok values ('Two', 2) >>insert into worksok values ('Three', 3) >> >>local loWorkingRS >>loWorkingRS = create('adodb.recordset') >> >>lnResult = loVFPCOM.CursorToRS(loWorkingRS, 'worksok') >> >>if lnResult = 0 >> >> * convert it back >> select 0 >> lnResult = loVFPCOM.RSToCursor(loWorkingRS, 'WorksOK2') >> >> if lnResult = 0 >> >> messagebox('WorksOK Works OK') >> >> else >> >> messagebox('Error Converting RS to Cursor ' + tran(lnResult)) >> use in worksok >> >> endif >> >>else >> messagebox('Error Converting Cursor ' + alias() + ' to RS ' + tran(lnResult)) >> use in worksok >> return >>endif >> >>use in worksok >>use in WorksOK2 >> >>* now do the one with a problem >>create cursor DoesntWork (charfield C(10), numfield N(3,0)) >>insert into DoesntWork values ('One', 1) >>insert into DoesntWork values ('Two', 2) >>insert into DoesntWork values ('Three', 3) >> >>local loNonWorkingRS >>loNonWorkingRS = create('adodb.recordset') loNonWorkingRS.CursorLocation = 3 >> >>lnResult = loVFPCOM.CursorToRS(loNonWorkingRS, 'DoesntWork') >> >>if lnResult = 0 >> >> * convert it back >> select 0 >> lnResult = loVFPCOM.RSToCursor(loNonWorkingRS, 'DoesntWork2') >> >> if lnResult = 0 >> >> messagebox('DoesntWork Works OK') >> >> else >> >> messagebox('Error Converting RS to Cursor ' + tran(lnResult)) >> use in DoesntWork >> >> endif >> >>else >> messagebox('Error Converting Cursor ' + alias() + ' to RS ' + tran(lnResult)) >> use in DoesntWork >> return >>endif>>