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?
Use an IIf
expression which produces the same result as Nz
.
select ID, IIf(PaymentAmount Is Null, 0, PaymentAmount) As nz_PaymentAmount
from Contracts;
Use IIF together with ISNULL function.
select ID, IIf(ISNULL(PaymentAmount), 0, PaymentAmount) As nz_PaymentAmount
from Contracts;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With