I am trying to get Database Data to insert into List View
Error Code:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object. occurred
I am trying to get Database Data to insert into List View
Error Code:
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object. occurred
Either shMsg or sqldb is null.
Put a breakpoint on line shMsg = FindViewById<TextView> (Resource.Id.shMsg);
Then check if your resource is filled, and if you step 1 execution further, if the variable shMsg
has a value.
Then proceed stepping until you realise which object has a null
value.
The reason you get this exception is because you're trying to get a property of something that doesn't exist, because it's null
.
If the sqldb
variable is null
, make sure you don't dispose of the connection to the database prematurely, which is a common mistake.