Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning Dataset from .Net via Interop
Message
From
28/08/2008 06:11:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01342153
Message ID:
01342485
Views:
13
>Hi Cetin,
>
>have you tried to iterate through Tables using FOR EACH? I found a number of COM objects won't work in VFP if you try to access a specific element, but work just fine when you iterate them.

Yes Christof,
Thanks for replying. I tried all sorts of code to get soemthing out of ds.Tables. It says it is an object and ds methods returning scalar values work. Just nothing from collections.

I saw that on west-wind Rick has an article claiming that he could return datasets, here is an excerpt from his article:

"In addition, collection based values are not accessible in the same way as you can from inside of .Net. The following does not work:



? loDS.Tables["Authors"].Rows[0]["au_lname"] && Doesn't work!!!



Named collections are common to native .Net objects, but I've been unable to use named collection items through VFP. You can however use them through positional collection values. The following does work:



? loDS.Tables.Item(0).Rows.Item(0).Item(1)

&& au_lname in the first row



There may be another way to get at the collection with names but I couldn't find it. This at least allows access to the features of the DataSet even though it can be hard to maintain code like this."


Now that he says it, I believe him it works. I can't see what I am missing (just now downloading his sample to try if that really works as is), Probably I need an attribute set (such as MarshallAs?).

His documentation is from 2002, my fear is that something has changed since then in how .Net returns it.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform