[ECH]JamHighlight
[ECH]JamHighlight
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
because ill have to repeat code over and ovr
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
I was hoping to avoid having to use the client at all
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
ye its in win forms
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
but How do I get the icon to work without doing it twice
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
but like
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
ik u said dont make http client
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
api.openweathermap.org/data/2.5/forecast?lat={lat}&lon={lon}&appid={API key} Ye i had to use this one instead
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
do I have to use a loop to go through the index
19 replies
CC#
Created by [ECH]JamHighlight on 4/3/2025 in #help
Accessing data for multiple days from weather api
Like where I add adding the icon [weather][0]
19 replies
CC#
Created by [ECH]JamHighlight on 3/25/2025 in #help
FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Cult
Ok so if you encounter this issue future viewers, you are mostly likely using a sql connection package that is not compatible with your net project.
12 replies
CC#
Created by [ECH]JamHighlight on 3/25/2025 in #help
FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Cult
No description
12 replies
CC#
Created by [ECH]JamHighlight on 3/25/2025 in #help
FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Cult
Ok so it appears to be compatiability issues.
12 replies
CC#
Created by [ECH]JamHighlight on 3/25/2025 in #help
FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Cult
Alr thx
12 replies
CC#
Created by [ECH]JamHighlight on 3/25/2025 in #help
FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Cult
Hm when I saw it on sparknotes I didnt see anyone disapproving
12 replies
CC#
Created by [ECH]JamHighlight on 3/18/2025 in #help
✅ Exception being thrown when attempting to use Weather api
async void callweatherapi()
{
string apiKey = "kanyecooked";
string city = Citysearch.Text;
string apiUrl = $"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={apiKey}&units=metric";
using (HttpClient client = new HttpClient())
{
if (client == null)
{
Debug.WriteLine("No client");
}
else

{
try
{
HttpResponseMessage response = await client.GetAsync(apiUrl);
response.EnsureSuccessStatusCode();
string json = await client.GetStringAsync(apiUrl);
if (json != null)
{
JObject weatherdata = JObject.Parse(json);
tempinfo.Text = weatherdata["main"]["temp"].ToString();
windspeedinfo.Text = weatherdata["wind"]["speed"].ToString();
humidityinfo.Text = weatherdata["main"]["humidity"].ToString();
cityinfo.Text = city;
countryinfo.Text = weatherdata["sys"]["country"].ToString();

Debug.WriteLine($"json {json}");

}
else
{
Debug.WriteLine("empty");
}
}
catch (Exception ex)
{
Console.WriteLine("Did not work" + ex.Message);
}

}
}
}
async void callweatherapi()
{
string apiKey = "kanyecooked";
string city = Citysearch.Text;
string apiUrl = $"https://api.openweathermap.org/data/2.5/weather?q={city}&appid={apiKey}&units=metric";
using (HttpClient client = new HttpClient())
{
if (client == null)
{
Debug.WriteLine("No client");
}
else

{
try
{
HttpResponseMessage response = await client.GetAsync(apiUrl);
response.EnsureSuccessStatusCode();
string json = await client.GetStringAsync(apiUrl);
if (json != null)
{
JObject weatherdata = JObject.Parse(json);
tempinfo.Text = weatherdata["main"]["temp"].ToString();
windspeedinfo.Text = weatherdata["wind"]["speed"].ToString();
humidityinfo.Text = weatherdata["main"]["humidity"].ToString();
cityinfo.Text = city;
countryinfo.Text = weatherdata["sys"]["country"].ToString();

Debug.WriteLine($"json {json}");

}
else
{
Debug.WriteLine("empty");
}
}
catch (Exception ex)
{
Console.WriteLine("Did not work" + ex.Message);
}

}
}
}
Completed for those who may need in the future.
36 replies
CC#
Created by [ECH]JamHighlight on 3/18/2025 in #help
✅ Exception being thrown when attempting to use Weather api
try
{
HttpResponseMessage response = await client.GetAsync(apiUrl);
response.EnsureSuccessStatusCode();
string json = await client.GetStringAsync(apiUrl);
if (json != null)
{
JObject weatherdata = JObject.Parse(json);
tempinfo.Text = weatherdata["main"]["temp"].ToString();
Debug.WriteLine($"json {json}");

}
try
{
HttpResponseMessage response = await client.GetAsync(apiUrl);
response.EnsureSuccessStatusCode();
string json = await client.GetStringAsync(apiUrl);
if (json != null)
{
JObject weatherdata = JObject.Parse(json);
tempinfo.Text = weatherdata["main"]["temp"].ToString();
Debug.WriteLine($"json {json}");

}
36 replies
CC#
Created by [ECH]JamHighlight on 3/18/2025 in #help
✅ Exception being thrown when attempting to use Weather api
I just had lines that weren't needed
36 replies
CC#
Created by [ECH]JamHighlight on 3/18/2025 in #help
✅ Exception being thrown when attempting to use Weather api
I got it working
36 replies
CC#
Created by [ECH]JamHighlight on 3/18/2025 in #help
✅ Exception being thrown when attempting to use Weather api
Alr
36 replies
CC#
Created by [ECH]JamHighlight on 3/18/2025 in #help
✅ Exception being thrown when attempting to use Weather api
U right u right
36 replies