Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Move data from VB ADO to VFP table
Message
 
À
30/04/1999 15:26:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00213673
Message ID:
00214575
Vues:
25
When working with SQL Server data, you are likely to run into some data conversion issues when transferring your data into a VFP Cursor. FWIW, I don't think the RSToCursor() method was really designed for this type of work. Rather, it provides an easy way to get your VFP data into a transportable ADO Recordset Object and vice-versa with the RSToCursor Method.

>>>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform