0

Hi,

I have this sort of problem whenever the datatable has an empty cell,
it shows cannot find column 6 or depending on the number of the datatable column cell.

Why does this happen and how can I resolve this?

Thanks

2
Contributors
2
Replies
5
Views
5 Years
Discussion Span
Last Post by jbutardo
0

This happens because the cell it is looking to get a value out of does not exist. Nothing was extracted from the database (or whatever the population method was) and so it crashes when it hits the null value.
You can either use defaults in your database to remove the null instances (meaning every record has some form of data in it) or add error checking in your code that can recover from trying to access a null object.
If an entire column is missing you may not have limited your search criteria or loop length to the number of columns in the data table. This is most commonly done by forgetting that the lengths of these objects are zero based and so if there are 5 columns in the data table your loop should run from 0 to 4, not 5.

0

This happens because the cell it is looking to get a value out of does not exist. Nothing was extracted from the database (or whatever the population method was) and so it crashes when it hits the null value.
You can either use defaults in your database to remove the null instances (meaning every record has some form of data in it) or add error checking in your code that can recover from trying to access a null object.
If an entire column is missing you may not have limited your search criteria or loop length to the number of columns in the data table. This is most commonly done by forgetting that the lengths of these objects are zero based and so if there are 5 columns in the data table your loop should run from 0 to 4, not 5.

Okay, already solved my problem, thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.