I got some fields from SQL server into my Foxpro cursor as below.
stra="SELECT cCm_Sgl_TaxInv,cInvNo FROM MIS.dbo.vInvFinalAll where cInvNo=?thisform.txtInvoiceNo.value"
SQLEXEC(hndOps,stra,'TaxInv')
And I need to check null values and not null values using IF condition. I wrote the following code and it does not give the expected result.
SELECT TaxInv
IF NOT ISNULL(cCm_Sgl_TaxInv)
ELSE
ISNULL(cCm_Sgl_TaxInv)
thisform.cmdCreate.Enabled = .T.
MESSAGEBOX("The value is already inserted")
endif
How can I do this?
It is not very clear what you are asking here, checking your code, probably this is what you meant:
IF ISNULL(TaxInv.cCm_Sgl_TaxInv)
thisform.cmdCreate.Enabled = .T.
MESSAGEBOX("The value is already inserted")
endif
EDIT: This could be simpler for what you are trying to do:
text to m.stra noshow
SELECT case when cCm_Sgl_TaxInv is null then 1 else 0 end as txStatus
FROM MIS.dbo.vInvFinalAll
where cInvNo=?thisform.txtInvoiceNo.value
endtext
SQLEXEC(m.hndOps,m.stra,'TaxInv')
if (TaxInv.txStatus = 1)
thisform.cmdCreate.Enabled = .T.
MESSAGEBOX("The value is already inserted")
endif