-
February 26th, 2014, 06:48 AM
#1
[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
-
February 26th, 2014, 12:34 PM
#2
Re: why this code crashes and how to fix it
You'd need to check it for nulls first, then proceed
-
February 26th, 2014, 06:54 PM
#3
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.
-
February 26th, 2014, 10:56 PM
#4
Re: why this code crashes and how to fix it
DevExpress? Why not contact them? Their support is paid by you or your employer
-
February 27th, 2014, 07:53 PM
#5
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...
-
March 8th, 2014, 02:25 AM
#6
Re: why this code crashes and how to fix it
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|