C
C#9mo ago
MohammedK

❔ 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
TheRanger
TheRanger9mo ago
did u debug and made sure an exception wasn't thrown in the try catch block?
MohammedK
MohammedK9mo ago
Yes, i have checked everywhere
TheRanger
TheRanger9mo ago
so u made sure ur method got called? did ur debugger breakpoint at line 129?
MohammedK
MohammedK9mo ago
Yes, i have my button that calls on the SaveData Method when clicked.
TheRanger
TheRanger9mo ago
yeah what about this?
MohammedK
MohammedK9mo ago
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?
TheRanger
TheRanger9mo ago
what do u mean u dont see anything?
MohammedK
MohammedK9mo ago
I dont see anything unusual or something that could tell me something is wrong
TheRanger
TheRanger9mo ago
my question is very simple did ur program pause at line 129? the line should glow yellow when it does
MohammedK
MohammedK9mo ago
No, the program keeps runing when i try to save something to the DB Nothing happens
TheRanger
TheRanger9mo ago
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 exception
MohammedK
MohammedK9mo ago
Oh 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')"}"
TheRanger
TheRanger9mo ago
yeah u tried to access an array out of its bounds
MohammedK
MohammedK9mo ago
My guess is that the problem lies somewhere from line 58 to 73, would that be correct?
TheRanger
TheRanger9mo ago
if ur exception was caught in line 133 Then the problem lies somewhere in your try block
Accord
Accord9mo ago
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.