我有以下命令对象:
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/