将列表返回到.NET Business Connector [英] Return a list to .NET Business Connector
本文介绍了将列表返回到.NET Business Connector的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当前,我正在使用以下代码:
Currently, I am using the following code:
Axapta ax = new Axapta();
string tableName;
ArrayList ax_cont = null;
ax.Logon(null, null, null, null);
try
{
ax_cont = (ArrayList)ax.CallStaticClassMethod("Code_Generator", "tableNames");
for (int i = 1; i <= ax_cont.Count; i++)
{
tableName = ax_cont[i].ToString();
tablesCB.Items.Add(tableName);
}
}
catch { }
但是我遇到了类型转换异常.
But I'm getting a type conversion exception.
从斧头动力学以AxpataObject
返回列表时,我需要在C#中做什么?
What do I need to do in C# when a list is returned from ax dynamics as an AxpataObject
?
推荐答案
这取决于Code_generator::tableNames()
返回的内容.
它肯定不会返回ArrayList
,但很可能返回AX List
,并且两者不相同并且不能进行强制转换.
It certainly does not return an ArrayList
but most likely an AX List
, and the two are not the same and cannot be casted.
一种方法是让AX返回容器,然后访问该.
One way would be to let AX return a container, then access that.
Otherwise you could access the AX List
directly using AxaptaObject
AxpataObject ax_cont = ax.CallStaticClassMethod("Code_Generator", "tableNames");
AxpataObject ax_it = ax_cont.Call("getEnumerator");
while (ax_it.Call("moveNext"))
// Hope you get it
这篇关于将列表返回到.NET Business Connector的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文