M
mrmagoo
I'm trying to add an object to a listbox. I'm using a DataReader from a
resultset from a stored procedure.
It works except when there are NULL in any of the rows. Then I get an error:
An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll
Additional information: Cast from type 'DBNull' to type 'String' is not
valid.
Me.lstMenu.Items.Add(New Menu(dr.Item("FirstTier"), dr.Item("SecondTier")))
How do I handle nulls? FirstTier is a string, SecondTier is a Long.
If I remove all nulls in the table, this works, but I need to keep the
nulls, so I need a solution..
Thanks. Any help is appreciated.
resultset from a stored procedure.
It works except when there are NULL in any of the rows. Then I get an error:
An unhandled exception of type 'System.InvalidCastException' occurred in
microsoft.visualbasic.dll
Additional information: Cast from type 'DBNull' to type 'String' is not
valid.
Me.lstMenu.Items.Add(New Menu(dr.Item("FirstTier"), dr.Item("SecondTier")))
How do I handle nulls? FirstTier is a string, SecondTier is a Long.
If I remove all nulls in the table, this works, but I need to keep the
nulls, so I need a solution..
Thanks. Any help is appreciated.