在MS Access中,是否有与NZ函数等效的ADO函数?

4

我有以下命令对象:

ADODB::_CommandPtr pCmd("ADODB.Command");

pCmd->ActiveConnection = pConn;
pCmd->CommandType = ADODB::adCmdText;
pCmd->CommandText = L" select ID, NZ(PaymentAmount, 0) from Contracts;";

ADODB::_RecordsetPtr pRS = pCmd->Execute(NULL, NULL, ADODB::adCmdText);

当我运行它时,它报告错误说NZ函数不存在。
我自己研究后发现,在ADO查询中不能使用NZ
问题:
是否有与此函数等效的ADO函数?
2个回答

6

使用一个与 Nz 产生相同结果的 IIf 表达式。

select ID, IIf(PaymentAmount Is Null, 0, PaymentAmount) As nz_PaymentAmount
from Contracts;

2

IIF 函数与 ISNULL 函数一起使用。

select ID, IIf(ISNULL(PaymentAmount), 0, PaymentAmount) As nz_PaymentAmount
from Contracts;

我已经点赞了,但没有正式接受,因为他先回答了。最好的问候。 - AlwaysLearningNewStuff
谢谢;) 顺祝商祺,Maciej - Maciej Los

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接