Delphi 5

240 pts.
Tags:
Delphi
Delphi 5.0
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

Answer Wiki

Thanks. We'll let you know when a new response is added.

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

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: