Dealing a Short datatype in VB.net

I have a field called(year built) with short data type ,need to validate that field with couple of validations how to that for 3 clauses??
1.Value should be equal to 9899 or be equal to or greater than '1600' and less than current date

Below is the code I have need to add these clauses :

    Private Sub YEARBUILT(ByVal Row As Input0Buffer)
        ColumnName = "YEAR_BUILT"

        If Row.inYEARBUILT_IsNull = True Then
            Row.outYEARBUILT_IsNull = True
        ElseIf Row.inYEARBUILT = 0 Then
            Row.outYEARBUILT_IsNull = True
       Else
           Row.outYEARBUILT = Row.inYEARBUILT
        End If
    End Sub
onebite2Asked:
Who is Participating?
 
käµfm³d 👽Commented:
Try:

Private Sub YEARBUILT(ByVal Row As Input0Buffer)
    ColumnName = "YEAR_BUILT"

    If Row.inYEARBUILT_IsNull = True Then
        Row.outYEARBUILT_IsNull = True
    ElseIf Row.inYEARBUILT = 0 Then
        Row.outYEARBUILT_IsNull = True
   ElseIf Row.inYEARBUILT = 9899 OrElse (Row.inYEARBUILT >= 1600 AndAlso Row.inYEARBUILT < DateTime.Now.Year)
       Row.outYEARBUILT = Row.inYEARBUILT
    End If
End Sub

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.