我试着一次从AX那里得到一定数量的记录。我想做一些相当于:
SELECT * FROM (SELECT *, ROW_NUMBER() AS ROWNO
FROM TableName)
AS TableName WHERE ROWNO > startIndex
AND ROWNO <= endIndex;目前,我正在从AX (使用.net业务连接器)获取所有记录:
axRecord.ExecuteStmt("select * from %1");
i = 0;
while(axRecord.Found)
{
if(i<startIndex)
{
i++;
continue;
}
// Perform operations
i++;
if(i==endIndex)
{
break;
}
}是否有更好的方法仅使用业务连接器来完成此操作?请帮帮忙
发布于 2013-02-26 09:43:06
在X++的内部SQL语法中,有一些关键字(firstOnly, firstOnly10, firstOnly100, firstOnly1000)来限制获取多少行。它可以与RecId字段相结合,手动获取模拟分页的行组:
select firstonly10 inventTable // only fetch 10 rows
index hint ItemIdx
where inventTable.RecId > lastRecIdFetched // save last recId for each page
&& inventTable.itemId == itemId;在MSDN上有select语句的完整语法引用:
http://msdn.microsoft.com/en-us/library/aa656402.aspx
https://stackoverflow.com/questions/14685281
复制相似问题