mardi 3 février 2015

how to handle null datetime in vb.net and convert them to specify datetime?


Vote count:

0




In the last line, it will prompt me error "Year, Month, and Day parameters describe an un-representable DateTime." when dr.item("t$ltdt") is equal to null value.


how can i handle null value datetime and convert them into specify datetime?


Dim sqlCur As String = "SELECT * FROM baan.ttiitm001800 WHERE (t$kitm ='1' or t$kitm='4') " & ItemCondtion & " ORDER BY t$item"



Dim cmd As New OracleCommand(sqlCur, connBaan)
Dim dr As OracleDataReader = cmd.ExecuteReader()

If dr.HasRows Then
While dr.Read()
Dim ChkItmCd As String = "SELECT Item_Code FROM MPC_Item_Master WHERE Item_Code='" & Trim(dr.Item("t$item")) & "' "
db.OpenTable(ChkItmCd)

If db.Eof Then
ItmType = Trim(dr.Item("t$kitm"))

If (Trim(dr.Item("t$kitm")) = "1") Then
ItmType = "PURCHASED"
ElseIf (Trim(dr.Item("t$kitm")) = "4") Then
ItmType = "COST"
End If

Dim ltdt As Date = dr.Item("t$ltdt")


asked 11 secs ago







how to handle null datetime in vb.net and convert them to specify datetime?

Aucun commentaire:

Enregistrer un commentaire