Compiler error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

System.InvalidCastException: Cast from type 'DBNull' to type 'String' is not
valid.
at Microsoft.VisualBasic.CompilerServices.StringType.FromObject(Object
Value)
at UH.Search.Page_Load(Object sender, EventArgs e)

What do I with a compiler error? This error is in most of my programs.
 
This error is due to late binding that you are using. Always Option Strict
On. That will make sure you catch these errors at compile time, rather then
at runtime.
 
Make sure the database column value is not null before attempting to cast it
as a specific data type.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Everybody picks their nose,
But some people are better at hiding it.
 
Back
Top