StrataFrame Forum

Conversion from type "DBNill" to type "Integer" is not valid

http://forum.strataframe.net/Topic28322.aspx

By Tiong Diu King - 9/10/2010

Hi all,

My BO get value cannot convert the null value to integer and show the error as image attached.
I did tried to change the get's coding in BO property as coding below and it's work. If i rebuild partial for that BO, it's coding back to original.
I'm license strataframe user and i got the framework coding. Please advice me how do i change the Generate BO code in strataframe framework.

   ''' <summary>
    ''' iPrdPeriodN_FK
    ''' </summary>
    <Browsable(False), _
     BusinessFieldDisplayInEditor(), _
     Description("iPrdPeriodN_FK"), _
     DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
    Public Property [iPrdPeriodN_FK]() As System.Int32
        Get
            'Return CType(Me.CurrentRow.Item("iPrdPeriodN_FK"), System.Int32)
                        If Convert.IsDBNull(Me.CurrentRow.Item("iPrdPeriodN_FK")) Then
                Return 0
            Else
                Return CType(Me.CurrentRow.Item("iPrdPeriodN_FK"), System.Int32)
            End If

        End Get
        Set(ByVal value As System.Int32)
            Me.CurrentRow.Item("iPrdPeriodN_FK") = value
        End Set
    End Property

Please advice and thanks
By Tiong Diu King - 9/11/2010

Hi all,

Mr. Ivan did solved my question at http://forum.strataframe.net/Topic28265.aspx?Update=1
Thanks Ivan
By Ivan George Borges - 9/11/2010

You are welcome, Tiong. Wink