[RESOLVED] why this code crashes and how to fix it
Db allows null in the table.. Thank for your help... hope to post in the right place..
Protected Sub ASPxGridView1_CustomUnboundColumnData(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewColumnDataEventArgs) Handles ASPxGridView1.CustomUnboundColumnData
If (e.Column.FieldName = "total1") Then
apples = Convert.ToInt32(e.GetListSourceFieldValue("apples"))<<---Object cannot be cast from DBNull to other types.
peach = Convert.ToInt32(e.GetListSourceFieldValue("peach"))
e.Value = apples + peach
End If
End Sub
Re: why this code crashes and how to fix it
You'd need to check it for nulls first, then proceed
Re: why this code crashes and how to fix it
I re-set the table column [apples] data type numeric(3,0) allow nulls unchecked, default value or binding to ((0)) but the default don't show in the table. when i rebuild the data-grid with a new sql data source default 0 don't show??? Is their another way around this?? thanks for the help.
Re: why this code crashes and how to fix it
DevExpress? Why not contact them? Their support is paid by you or your employer
Re: why this code crashes and how to fix it
fixed it.. my boss said wait until he gets back into town to look at it.. Too late fixed it myself.. thanks for the help anyhow...
Re: why this code crashes and how to fix it
Quote:
Originally Posted by
iwzhidden
fixed it.. my boss said wait until he gets back into town to look at it.. Too late fixed it myself.. thanks for the help anyhow...
I am happy you have fixed it yourself. Please post your solution so that members encountering the same problem can be able to get help.