Object reference not set to an instance of an ojbect
Using a Multi data source is the best way to create a map that only creates new records and not update.
Make sure the Excel file is closed before you try to preview your data source or run the map. If the file is open you can see connection errors similar to this one.
Another possibility is there is an issue with the name of a field in your file. Make sure there aren’t any special characters or spaces in your column headers and try again.
Hi Ethan,
could it possibly have anything to do with the actual data that is stored in the asset_label field? I have tried multiple approaches and it just won’t let me use the asset_label field. It has no problem if i use the assetid field, but that wont’ work for my scenario.
In a nutshell it means.. You are trying to access an object without instantiating it.. You might need to use the “new” keyword to instantiate it first i.e create an instance of it. An Object is an instance of a Class , it is stored some where in memory. A reference is what is used to describe the pointer to the memory location where the Object resides. The message “object reference not set to an instance of an object” means that you are referring to an object the does not exist or was deleted or cleaned up. It’s usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested for null before being used.
if (mClass != null)
{
// Go ahead and use mClass
mClass.property = …
}
else
{
// Attempting to use mClass here will result in NullReferenceException
}