Reputation: 3031
I have the following command object:
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);
When I run it, it reports error that NZ function does not exists.
Researching on my own, I have found out that I can not use NZ
in ADO queries.
Is there ADO equivalent to this function?
Upvotes: 4
Views: 613
Reputation: 8591
Use IIF together with ISNULL function.
select ID, IIf(ISNULL(PaymentAmount), 0, PaymentAmount) As nz_PaymentAmount
from Contracts;
Upvotes: 2
Reputation: 97131
Use an IIf
expression which produces the same result as Nz
.
select ID, IIf(PaymentAmount Is Null, 0, PaymentAmount) As nz_PaymentAmount
from Contracts;
Upvotes: 6