Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning Dataset to VFP via COM Interop
Message
From
27/08/2008 08:31:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
All
General information
Forum:
ASP.NET
Category:
Troubleshooting
Title:
Returning Dataset to VFP via COM Interop
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01342154
Message ID:
01342154
Views:
59
Returning .Net objects to VFP via COM Interop.

It looks like it works but the problem is:
LOCAL lo as "MyInterop.MyComm", ds
lo = CREATEOBJECT("MyInterop.MyComm")
ds = lo.GetDataset("HumanResources.Department")
? ds.ToString() && "System.Data.DataSet"
? type('ds.Tables') && Object
? ds.Tables.Count && error
? ds.Tables.Item(0).Rows.Item(0).Item(1) && error

* this works and I get the result
XMLTOCURSOR(ds.GetXML,'result') 
browse
Neither ds.Tables.Item(0)... nor ds.Tables(0)... work. Any idea?

Here is the very simplified version of .Net code:
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;

namespace MyInterop
{
    [ClassInterface(ClassInterfaceType.AutoDual)]
    [ProgId("MyInterop.MyComm")]
    [ComVisible(true)]
    public class MyComm
    {
        public DataSet GetDataset(string tableName)
        {
            DataSet ds = new DataSet();
            SqlConnection con = 
               new SqlConnection("server=.\\sqlexpress;database=AdventureWorks;Trusted_connection=yes");
            SqlDataAdapter adp = new SqlDataAdapter(String.Format("select * from {0}", tableName), con);
            adp.Fill(ds);

            return ds;
        }
    }
}
Thanks in advance.
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
Reply
Map
View

Click here to load this message in the networking platform