0

我在 c# 中有一些使用 AX 业务连接器的代码,如下所示:

AxaptaRecord OrderRecord = (AxaptaRecord)ax.CallStaticClassMethod("BTNOnlineOrder", "getSalesOrder", salesRef);

if (OrderRecord.Found)
{
     AxaptaObject Lines = (AxaptaObject)OrderRecord.Call("querySalesLine");
     AxaptaObject qrLines = (AxaptaObject)ax.CreateAxaptaObject("QueryRun", Lines);

     while ((bool)qrLines.Call("next"))
     {
          int tableid = (int)ax.CallStaticClassMethod("Global", "tableName2Id", "InventTable");
          AxaptaRecord r = (AxaptaRecord)qrLines.Call("get", tableid);
     }  
}

当我尝试调用“get”方法时出现以下错误:

执行代码时出错:函数的参数类型错误。

tableid 返回一个 int 值,175,所以这不是由于 tableid 为 null 或什么的。

任何帮助,将不胜感激

4

2 回答 2

2

如果您使用的查询没有指向 InventTable 的数据源,您将收到此(令人困惑的)错误。我已经验证此代码会在 Ax sys 层中的默认 SalesLine 查询中引发此异常。我同意,这是一个令人困惑的错误。

如果您的消费代码中需要 InventTable,您将需要定义一个自定义查询并从 querySalesLine 方法返回该查询。

于 2012-03-16T19:01:05.677 回答
0

I got this to work by using the getNo method and passing 1 as the parameter. I'm not sure if it's the correct way or not but it worked for me:

http://msdn.microsoft.com/en-us/library/aa612609(v=ax.50).aspx

于 2012-03-19T15:15:09.397 回答