Conversion from type 'DBNull' to type 'Date' is not valid

前端 未结 2 1646
滥情空心
滥情空心 2020-12-21 01:37

I am getting this exception from the following VB.NET code for only certain months:

System.InvalidCastException: Conversion from type \'DBNull\' to type \'Da         


        
2条回答
  •  半阙折子戏
    2020-12-21 01:52

    check for null with dRow.IsNull("CompleteDate") before you ask for the value.

    Or if this is 'supposed to be' impossible, change your query to never return rows where it can be null.

提交回复
热议问题