listDates = (From row In ds.Tables(0) Select row.Field(Of Date)("Check In")).ToList arrDates = listDates.ToArray For a = 0 To arrDates.Length - 1 arrDatesStr(a) = (arrDates(a)).ToString Next
I am making an analytics form to find the most popular month for a hotel:
- listDates is a list that stores all of the dates from the database
- arrDates is the conversion of listDates to an array
- arrDatesStr is the array I need to fill with the date values but as strings, so i can substring the month
I have checked the values in listDates and arrDates and they conversion is successful, but when I try to convert it to string it says
"System.NullReferenceException: 'Object reference not set to an instance of an object.'"
How do I convert arrDates to a string and input those values into arrDatesStr?