EDN Admin
Well-known member
<span id="_ctl0_MainContent_PostFlatView <span>I have a C# API for interacting with a DB that i have set up. I need to return data to users in excel via hitting this API which calls a sproc on the DB.
The problem i am having is in returning the data from the c# method, id like to return a datatable object, but maybe this isnt possible. I have the .Net class registered and i can see that it is called from the module in excel, it works if the return type is an int or string, but what do i have to do to be able to have the method return a datatable and be able to output its data to a sheet?
[ComVisible(true)]
public class TempClass
{
public DataTable MyTable()
{
DataTable result = GetData();
return result;
}
}
Public Sub GetData()
Dim temp As TempClass
Dim result As DataTable
Set temp = New TempClass
Set result = temp.MyTable()
---> error: object required
output the info in the datatable
View the full article
The problem i am having is in returning the data from the c# method, id like to return a datatable object, but maybe this isnt possible. I have the .Net class registered and i can see that it is called from the module in excel, it works if the return type is an int or string, but what do i have to do to be able to have the method return a datatable and be able to output its data to a sheet?
[ComVisible(true)]
public class TempClass
{
public DataTable MyTable()
{
DataTable result = GetData();
return result;
}
}
Public Sub GetData()
Dim temp As TempClass
Dim result As DataTable
Set temp = New TempClass
Set result = temp.MyTable()
---> error: object required
output the info in the datatable
View the full article