Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPCOM utility
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00338633
Message ID:
00339029
Vues:
33
Be sure to make your ADO Recordset a client-side Recordset:

loNonWorkingRS.CursorLocation = 3

By default, ADO recordsets are server-side (cursorlocation = 2)



>Hey JVP, while we're on the subject:
>
>Any idea why RSToCursor would choke trying to convert a RS back to a cursor that was originally created with CursorToRS and contains a numeric (or float or double) field:
>
>
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')
>
>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
>
>Notice that the second RSToCursor() bombs out with a return value of -10 = "Failed to create Fox cursor" (see http://support.microsoft.com/support/kb/articles/Q235/9/85.ASP) for return codes
>
>Cheers,
>
>Andrew
>

>>The idea is actually very simple. VFPCOM fabricates an ADO recordset with the same structure as the VFP table. The records from the VFP table are then marshaled to the new ADO recordset. Once that process is complete, the recordset is returned to the calling program.
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform