在我的课堂上:
Namespace Chauffeurs
Public Class Algemeen
Property FirmaId As Integer?
Property Firma As String
Public Sub New()
End Sub
Public Sub New(ByVal firmaId As Integer?, Optional ByVal id As Integer = 0)
'I don't even reach this point.
Me.FirmaId = firmaId
End Sub
End Class
Public Class Yard
Inherits Chauffeurs.Algemeen
Public Sub New()
End Sub
Public Sub New(ByVal drv As DataRowView)
MyBase.New(drv(2), drv(1), drv(3), drv(4), drv(0)) '<--- error occurs here
End Sub
在我的表格中:huidigeChauffeur = New allePersonen.Chauffeurs.Yard(drv)
我 100% 确定在 drv(4) 中有一个 DBNull。但我仍然收到错误“指定的演员表无效”,即使我使用可空值
额外:如果我输入 Cint(drv4),我会收到错误“从“DBNull”类型转换为“Integer”类型无效。这不是 Nullable 应该捕获的吗?!