如何检查是否可以使用下一个运算符?

编程入门 行业动态 更新时间:2024-10-09 21:26:22
本文介绍了如何检查是否可以使用下一个运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

任何Axapta版本的问题:

Questions for any Axapta version:

  • 如何检查'next'运算符可以与记录一起使用?
  • 如何抑制不可接受的下一个"运算符上的调试器?
  • 谢谢.

    复制代码:

    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.

    更多推荐

    如何检查是否可以使用下一个运算符?

    本文发布于:2023-11-09 03:59:34,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1571340.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:可以使用   运算符

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!