我有以下命令对象:

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/

10-13 06:28