I am having troubles with the RsToCursor() method that came with VFPCOM. It works pretty good when the cursor does NOT have numeric fields.
The error that I am getting is -10. Is this a documented error? Where?
Am I doing something wrong (stupid)?
Below is the sample code that I am using. It works fine without the numeric field (field3):
* Instanciate VFPCOM and ADODB classes
clear
oComUtil = createobject("vfpcom.comutil")
oRecordSet = createobject('adodb.recordset')
* Create a dummy table with a blank record.
create table table1 ( field1 C(10), field2 D, field3 N(5,2) )
use table1
append blank
use in table1
select * from table1 into cursor MyCursor
* Copy cursor to a recordset.
select MyCursor
? 'cursortors() ->', oComUtil.cursortors( oRecordSet )
use in MyCursor
* Use the recordset.
? oRecordSet.movefirst
? oRecordSet.recordcount
? oRecordSet.fields(0).name, oRecordSet.fields(0).value
* Send the recordset back to a VFP cursor.
? 'rstocursor() ->', oComUtil.rstocursor( oRecordSet, 'MyCursor' )
? 'alias() ->', alias( 'mycursor' )
* Release classes.
oComUtil = null
oRecordSet = null
Hector Correa