Compiler error

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.
 
M

Marina

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.
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top