Saturday, February 25, 2012

convert null to 0

I am trying to convert a value of null to 0. Can I do ot in the VIEW i created. I am calling from the VIEW from a query on my page and using a datareader to populate a datagrid. The error I get is
Operator is not valid for type 'DBNull' and type 'Decimal'.

<<itemtemplate><%# String.Format("<font color="darkred">{0:c}</font>", (DataBinder.Eval(Container.DataItem, "MyDecimal"))*(DataBinder.Eval(Container.DataItem, "price"))) %>
Line 81: </itemtemplate>
Line 82: </asp:templatecolumn>

Thanks for any helpOH,
The sql function ISNULL(mydecimal,'0') as my decimal
thanks anyway!!|||use
isnull(price,0)
in the query

hth

No comments:

Post a Comment