考虑:
Private Function ViewPropertyCast(ByVal type As String) As String
Select Case type
Case "smallint"
Return "Short"
Case "nvarchar"
Return "String"
Case "int"
Return "Integer"
Case "float"
Return "Double"
Case "datetime"
Return "Date"
Case "bigint"
Return "Long"
Case "ntext"
Return "String"
Case "bit"
Return "Boolean"
Case "uniqueidentifier"
Return "Guid"
End Select
End Function
Run Code Online (Sandbox Code Playgroud)
为什么ViewPropertyCast不在所有代码路径上返回值?
因为如果type是没有这些东西上市,它只是下降到不返回任何底部.
尝试类似的东西:
Private Function ViewPropertyCast(ByVal type As String) As String
Select Case type
Case "smallint"
Return "Short"
Case "nvarchar"
Return "String"
Case "int"
Return "Integer"
Case "float"
Return "Double"
Case "datetime"
Return "Date"
Case "bigint"
Return "Long"
Case "ntext"
Return "String"
Case "bit"
Return "Boolean"
Case "uniqueidentifier"
Return "Guid"
End Select
Return "NoIdea" ' <-- Added this bit '
End Function
Run Code Online (Sandbox Code Playgroud)