任何Axapta版本的问题:
Questions for any Axapta version:
谢谢.
复制代码:
static void Job13(Args _args) { CustTrans ct1; CustTrans ct2; // let's assume that method 'one' search a record select ct1; // where ct1.AccountNum == 'someAccount' ct2.data(ct1.data()); // contract postcondition Debug::assert(ct1.RecId != 0); Debug::assert(ct2.RecId == ct1.RecId); ////////////////////////////////// // let's assume that method 'two' accepts a custTrans record as parameter Debug::assert(ct2.RecId != 0); try { // Questions: // 1. How to check that 'next' can be used? // 2. How to suppress a debugger? next ct2; } catch { Warning('catch it!'); } }+作业运行在ax2009中后创建的几个屏幕截图.
+a couple of screenshots that created after job runs in ax2009.
推荐答案
按照 MSDN文章:
select语句仅获取一条记录或字段.获取 其他记录,可以使用下一条语句.下一条语句 获取表中的下一条记录. 如果您使用next而没有 之前的select命令,会发生错误.请勿将next与 firstOnly查找选项.如果您需要遍历许多记录,它会 更适合使用while select语句.
The select statement only fetches one record, or field. To fetch additional records, you can use the next statement. The next statement fetches the next record in the table. If you use next without a preceding select command, an error occurs. Do not use next with the firstOnly find option. If you need to traverse a number of records, it is more appropriate to use a while select statement.
您已将 next 命令与 ct2 一起使用,而没有将 select 命令(与 ct1 一起使用).
You have used next command with ct2 without preceding select command (which you used with ct1).
更新:使用if (ct1.found()) next ct1;可以帮助您避免意外的错误.
Update: Using if (ct1.found()) next ct1; can help you avoid unexpected errors.
更多推荐
如何检查是否可以使用下一个运算符?
发布评论