❔ Need help to save data in to my Database
Im currently trying to make a Weather app, and im using diffrent API:s. And with one API i have it has data saved from all the way back to 1960 ish. And im trying to make a program where i can for example search between 2000 - 2001 and it shows the avrage temp per month. And i have this code that doesnt show me any errors and i have tried everything to understand why it doesnt work, but it doesnt. When im trying to save data to my DB nothing happens, nothing new comes in to the database and the program is still running without problems?
I really dont understand what is happening with my code and would appreciate some help.
This is my Code:
https://paste.mod.gg/upanazrqdewj/0
BlazeBin - upanazrqdewj
A tool for sharing your source code with the world!
16 Replies
did u debug and made sure an exception wasn't thrown in the try catch block?
Yes, i have checked everywhere
so u made sure ur method got called?
did ur debugger breakpoint at line 129?
Yes, i have my button that calls on the SaveData Method when clicked.
yeah what about this?
i dont see anything when i put a breakpoint on 129. i have put a breakpoint on 121 and there i can see that all of the things i want to save gets the correct value. Or am i understanding your question wrong?
what do u mean u dont see anything?
I dont see anything unusual or something that could tell me something is wrong
my question is very simple
did ur program pause at line 129?
the line should glow yellow when it does
No, the program keeps runing when i try to save something to the DB
Nothing happens
then ur exceptio nwas caught
Logger.LogError($"Exception caught: {ex.Message}");
you should check your log
if you placed a breakpoint at that line(133) and ur program paused there
then it probably threw an exceptionOh ok, now i see the error message it said: "ex = {"Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')"}"
yeah u tried to access an array out of its bounds
My guess is that the problem lies somewhere from line 58 to 73, would that be correct?
if ur exception was caught in line 133
Then the problem lies somewhere in your try block
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.