Anon-E-Moose wrote:
"MattB" <so********@yahoo.com> wrote in
news:2t*************@uni-berlin.de:
If Not IsNothing(e.Item.DataItem("guest_name")) Then
...
End If
But it seems a value of DBNull
Why not compare it directly to DBNull?
If Not e.Item.DataItem("guest_name") is DbNull.Value?
I think that works.
Thanks. When I tried that I got this result, which seems very weird to me.
Hopefully I'm just not fully understanding what's happening here. Any ideas?
Cast from type 'DBNull' to type 'String' is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Cast from type 'DBNull' to
type 'String' is not valid.
Source Error:
Line 457: 'split the names into individual links
Line 458: If e.Item.DataItem("Qty") > 1 And Not
e.Item.DataItem("guest_name").GetType Is DBNull.Value Then
Line 459: Dim strName() As String =
Split(e.Item.DataItem("guest_name"), "<br>")
Line 460:
Line 461: cell.Controls.Remove(h)