Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can't retrieve MEMO data
Message
De
05/02/2018 00:53:43
 
 
À
04/02/2018 12:52:39
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01657782
Message ID:
01657817
Vues:
37
Yes, think the dll is the easiest solution - considering the amount of databases to process -

>Hi,
>
>I think the cursor creation was OK. Macro expression were definitely not.
>
>Ended up using a VFP DLL as suggested by Marc - easier than messing with SP's (there are about 3000 databases that need to be processed and I would have had to add the SPs to all of them prior to processing).
>At the moment I'm extracting the array, converting to a cursor, converting that to XML in VFP and then using that on the C# side to create a list of objects.
>Bit long winded but works well enough......
>
>>Viv,
>>
>>
>>Look here https://technet.microsoft.com/en-us/aa975627
>>
>>(1) Create cursor is not supported
>>Think you can get away with that using
>>
>>select	cast(0 as N(5)) as Val1, ;
>>		cast(0 as N(5)) as Val2 ;
>>		from (m.theFile) ;
>>	into cursor temp readwrite
>>
>>
>>(2) Think Macro expansion is not supported
>>
>>(3) I don't see RESTORE FROM in the list of supported command either
>>
>>
>>
>>>Hmm. But the core of the problem is in retrieving the data in a usable format from the MEMO field. Without 'REST FROM MEMO' the only way would be either to access the DBF file in it's 'raw' state from C# by navigating the table structure (which would be a nightmare) or, as suggested, elsewhere to use a VFP COM DLL.
>>>
>>>Pretty sure the VFPOLEDB problem is because macro expansion is not supported - which begs the question of how else this could be achieved in the SP .....
>>>
>>>>Blast from the past - restore from, early attempt at NoSQL ;-))
>>>>
>>>>IIRC the way the memvars/arrays are saved in the memo field has binary hints. Try to serialize, probably fastest way would be passing the cursor of your vfp code via clipboard. Safer of course anything toJSON, but probably slower. Marshalling the array might also work, but accessing each vfp array element from C# is chatty, not chunky across marshalling borders, so I'd try generating a single "item" on vfp side first and destructure that on .Net side. More code, less context switch
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>Trying to retrieve an array stored in a VFP MEMO field using a VFP SP via VFPOLEDB.
>>>>>
>>>>>The SP looks like this:
PROCEDURE GetShortNutri
>>>>>LPARAMETERS theFile, theField, theRecno
>>>>>USE &theFile. ORDER Id
>>>>>=SEEK(theRecno)
>>>>>RESTORE FROM MEMO &theField.
>>>>>CREATE CURSOR result (Val1 N(5), Val2 N(5))
>>>>>APPEND FROM ARRAY pgndata 
>>>>>SETRESULTSET('result')
>>>>>RETURN RECCOUNT('result')
>>>>>ENDPROC
The C# code:
using (OleDbConnection conn = new OleDbConnection(this.ConnectionString))
>>>>>            {
>>>>>                DataSet ds = new DataSet();
>>>>>
>>>>>                string commandString = "GetShortNutri('" + this.TableName + "','" + this.FieldName + "'," + this.Record + ")";
>>>>>                conn.Open();
>>>>>                OleDbCommand command = new OleDbCommand(commandString, conn);
>>>>>                command.CommandType = CommandType.StoredProcedure;
>>>>>                var adapter = new OleDbDataAdapter(command);
>>>>>                adapter.Fill(ds);  //Exception: 'Feature not available'
>>>>>            }
>>>>>
>>>>>SP works in VFP. All parameters are correct in the C# code (TableName and FieldName are strings; Record is int) . But 'adapter.Fills(ds)' throws the commented exception. Any suggestions ?
>>>>>
>>>>>Oh, and I tried substituting ' (theField) ' instead of ' &theField ' etc. same thing....
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform