240 pts.
 Delphi 5
How to check the database field if null then populate the grid cell with zero else with the value entered in the cell. while not eof do begin grdDeal.Cells[0,iRow] := FieldByName('WORKBASKET_DESC').asString; if ( FieldByName('PRODUCT_DEAL_NO').asString = null) then grdDeal.Cells [1,iRow] := 0 else grdDeal.Cells [1,iRow] := FieldByName('PRODUCT_DEAL_NO').asString; grdDeal.Cells[2,iRow] := FieldByName('WORKBASKET_ID').asString; inc(iRow); Next; end; grdDeal.RowCount := iCount + 1; end; end; Can anyone tell why the above query is returning an error to me.Kinldy tell me what is the correct syntax for the above statements.Please be fast.It should be delivered tomorrow.Thanks in advance

Software/Hardware used:
ASKED: May 22, 2008  6:16 AM
UPDATED: May 22, 2008  12:37 PM

Answer Wiki:
Hello Rajalakshmi08, I don't remember how Delphi handles the null fields, anyway you can bypass the problem by filling the null fileds of your query with 0. Example: <pre> SELECT (ISNULL(MYFIELD,0)) AS MYVAL FROM MYTABLE </pre> The query above will retunn 0 if the <i>MYFIELD=Null</i>. Bye
Last Wiki Answer Submitted:  May 22, 2008  6:35 am  by  alessandro.panzetta   9,695 pts.
All Answer Wiki Contributors:  alessandro.panzetta   9,695 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _