>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
At Mike Feltman's session, he said that the cursor using VFPCOM is limited in comparison to simply using the ADO directly. You might as well develop your own wrapper class around ADO calls, which is basically what VFPCOM is doing or taking Craig's suggestion and using Levy's class.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement