Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Move data from VB ADO to VFP table
Message
From
30/04/1999 15:26:03
 
 
To
30/04/1999 14:10:29
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00213673
Message ID:
00214075
Views:
26
>>SNIP
>>>
>>>It's possible in a couple of ways. An ADO recordset can be passed to an OLE Object in VFP 6, and viewed/manipulated in the object, or you can create an OLE object in VB, and call it from VFP to have it return a recordset object. Once VFP has the RS object, you can maniplate it from there using its properties and methods, or convert it to a dbf using your own routine, or one of several generic ones that are available as freeware.
>>>
>>>I hear ADO 2.1 has methods to save and restore RS objects to file. Using htese, you could save the RS to a file, and restore it from the file in VFP. I can't tell you the syntax, because I haven't used these methods yet.
>>
>>Thanks for the reply Eric. I need to toss this in, I am conveying this question for a coworker and am not actually doing it. But I did suggest to him an OLE object that he could use as you suggest.
>>
>>I thought he could use the VFPCOM.dll to this, but I need some concrete examples to appease him. I was hoping someone had done this and could speed up the investigation.
>>
>>I will have a look at the 2.1 save to file option.
>>
>>Thanks!
>Hey Kendall,
>I gather you already have your VB code that handles a recordset object. Well, whenever you feel is appropriate, save the recordset by using the save method myRS.Save "C:\PersRS.rs". Then, from VFP do:
>oRS=CreateObject("ADODB.Recordset")
>oRS.Open("C:\PersRS.rs")
>? oRS.Fields(0).Name
>? oRS.Fields(0).Value
>Etc. Pretty straightforward, isn't it?
>P.S. make sure you have the latest MDAC components.

Thanks for the reply.

While I've been away I did almost exactly as you suggest, except I used the vfpcom.dll to convert the recordset to a cursor and it does work. Pretty cool.

After saving the recordset to a file I did this;

#DEFINE C_VFPCOMCLASS 'vfpcom.comutil'
oADO = CreateObject(C_VFPCOMCLASS)
oMyRecordSet = CreateObject('ADODB.RECORDSET')
oMyRecordSet.Open("c:\download\testdata.rs",,3,3)

nError = oADO.RSToCursor(oMyRecordSet, 'mycursor')

Thanks again.
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform