Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFPCOM utility
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Miscellaneous
Thread ID:
00338633
Message ID:
00339462
Views:
37
Thanks, but it generates the same error (see changes to code below)

Garrett says that they know about it and that he "hopes they fix it soon" - whatever that means.

Cheers,

Andrew




>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')
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
>>
>>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.
>>>


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform