Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning Dataset to VFP via COM Interop
Message
De
27/08/2008 08:31:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Problèmes
Titre:
Returning Dataset to VFP via COM Interop
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Divers
Thread ID:
01342154
Message ID:
01342154
Vues:
60
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
Répondre
Fil
Voir

Click here to load this message in the networking platform