Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recordset to Cursor
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01098156
Message ID:
01098191
Vues:
15
Well Sergey, if it wasn't for the fact that the CursorAdapter throws an error on ADO variant fields (AERROR returns data type mismatch), this would be my solution. It's really fast too... way faster than RS2DBF, but with RS2DBF it will at least turn those variant fields into character fields. This could be considered a bug or by design depending on how you look at it, but for me it means that the following only works when there are no variant fields...
***************************************
FUNCTION GetCursorFromRS(toRecordSet, tcCursorName)
***************************************
*!* Fails on certain fields that
*!* are variants, and CursorAdapter throws an error
*!* whereas RS2DBF will create a character field for variants
	LOCAL loMyCursor as CursorAdapter
	loMyCursor = CREATEOBJECT("CursorAdapter")
	loMyCursor.DataSourceType="ADO"
	loMyCursor.Alias = tcCursorName
	loMyCursor.CursorFill(,,,toRecordSet)
	loMyCursor.CursorDetach()
ENDFUNC
>Hi Craig,
>
>You can use CursorAdapter. See Re: CursorAdapters and existing ADO recordsets Message #824438 for sample code.
>
>>What's the best way known to transform a recordset into a cursor? Say you've got an ADO recordset that is already filled with data and you want to create a Visual FoxPro cursor from that recordset? I'm not looking to execute a SelectCmd on a CursorAdapter by issuing a CursorFill, as I already have the filled recordset object. One way I've found is using the r2dbf.prg that Microsoft released... http://www.kbalertz.com/192692/Converting.Recordset.Cursor.aspx
>>
>>I guess I'm looking for a slicker way to do this in VFP 9. I'm not sure if there is one, but if there is I'm sure someone on this list will have the answer. Thanks in advance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform