Jorjo
✅ IndexOutOfRangeException when trying to set class properties to reader return values
It was a privilege issue, there are some procedures that create separate databases for each city and my fellow practician here forgot to update the prodecure to give it rights to the newly created database. It couldn't access it the whole time.
27 replies
✅ IndexOutOfRangeException when trying to set class properties to reader return values
Oh well yeah I tried debugging it, hence why when I use an index for the column instead of the alias it gives me the weird value of 916 I got that from debugging the property being set to that but since I'm using the stored procedure alias it just gives a value of null and crashes due to me removing the exception handling logic. But do you need me to check the reader's values instead?
27 replies
✅ IndexOutOfRangeException when trying to set class properties to reader return values
This is supposed to create a new object with it's property values set to what the reader returns then later add the new objects with their respective values to a list which will be used in a for loop to itterate the property values and display information inside some paragraph elements and such. However despite the stored procedure working and returning the right results based on the city name it causes an exception to occur which is the attached image to this post. I tried doing exception handling as well but the exception message when printing to the debug console is simply just "ProductName" which is weird to say the least. The column names are written correctly but it still returns null no matter what, except when indexed, then the Name property gets the value of 916.
27 replies