COM .NET Interop - How to return a DataTable from
Hi, I need help here.. I have this problem.
I have COM VB6 that call a .NET class library, and this class library use the .NET SAP Conector to extract the information from SAP. I receive the information from SAP in a DataTable, the problem here is that I dont how to return this DataTable to VB6 COM.
I made a test, and I can return a String to COM and basic types, but I dont know how to do it with this DataTable.
Thanks for your help
I really appreciate.
Public Interface interfaceSapNet
Function Get_Z_YACV_READ_GINCOTABS(ByVal I_LAND As String, ByVal I_Z1DELN As String, ByVal I_Z1LONO As String, ByVal I_Z1LTCY As String, ByVal I_Z1MCU As String, ByVal I_Z1XSIA As String) As XXXXXXXX
End Interface
Public Class rfcFunctionsNetSap
Implements interfaceSapNet
Public Function Get_Z_YACV_READ_GINCOTABS(ByVal I_LAND As String, ByVal I_Z1DELN As String, ByVal I_Z1LONO As String, ByVal I_Z1LTCY As String, ByVal I_Z1MCU As String, ByVal I_Z1XSIA As String) As String _
Implements interfaceSapNet.Get_Z_YACV_READ_GINCOTABS
Dim DataTableSap As DataTable = New DataTable
Dim xmlString As String
' build the connection string (update this with your connection info)
Dim cs As String = "CLIENT=xxx USER=xxx PASSWD=xxx LANG=EN ASHOST=xxx SYSNR=0"
' construct the proxy with connection string
Dim proxy As New SAPProxy1(cs)
' create a sap table variable
Dim tableOutPut As New ZXX_GINCOTESTTable
' call the RFM method on the proxy
proxy.Z_Yacv_Read_Gincotabs(I_LAND, I_Z1DELN, I_Z1LONO, I_Z1LTCY, I_Z1MCU, I_Z1XSIA, "", tableOutPut)
//================================================== ==
//HERE IS THE PROBLEM, I DONT HOW TO RETURN THIS TABLE TO VB6
//================================================== ==
DataTableSap = tableOutPut.ToADODataTable
//================================================== ==
Return DataTableSap
End Function
jhpe
|