ActiveConnection = pConn; pCmd->CommandTyp-6ren">
gpt4 book ai didi

c++ - MS Access 中 NZ 函数的 ADO 等价物?

转载 作者:太空狗 更新时间:2023-10-29 20:12:19 25 4
gpt4 key购买 nike

我有以下命令对象:

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等价于这个函数吗?

最佳答案

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

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

关于c++ - MS Access 中 NZ 函数的 ADO 等价物?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28532123/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com