[ECH]JamHighlight
[ECH]JamHighlight
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
public void makenewuser()
{
string constring = "Data Source =LAPTOP-3KI3JMHO; Initial Catalog = Stormz; Integrated Security = True";
using (SqlConnection con = new SqlConnection(constring))
try
{
con.Open();
SqlCommand com = new SqlCommand("INSERT INTO users('" + firstname + "','" + lastname + "','" + email + "','" + password + "','" + country + "', '" + city + "')", con);
com.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}

}
public void makenewuser()
{
string constring = "Data Source =LAPTOP-3KI3JMHO; Initial Catalog = Stormz; Integrated Security = True";
using (SqlConnection con = new SqlConnection(constring))
try
{
con.Open();
SqlCommand com = new SqlCommand("INSERT INTO users('" + firstname + "','" + lastname + "','" + email + "','" + password + "','" + country + "', '" + city + "')", con);
com.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}

}
This is the method giving the issue. Before I was using System.Data.SqlClient but it gave me an error so I switched to Microsoft.Data.SqlClient now im getting this issue. I downloaded the package and it exist so im not to sure why it keeps throwing an the exception in the title.
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())
{
try
{
HttpResponseMessage response = await client.GetAsync(apiUrl);
response.EnsureSuccessStatusCode();
string json = await client.GetStringAsync(apiUrl);
WeatherConditions.Rootobject weatherdetails = JsonConvert.DeserializeObject<WeatherConditions.Rootobject>(json);
forcastinfo.Text = weatherdetails.weather[0].main;
windspeedinfo.Text = weatherdetails.wind.speed.ToString();

if(weatherdetails == null)
{
Debug.WriteLine("no data");
}

}
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())
{
try
{
HttpResponseMessage response = await client.GetAsync(apiUrl);
response.EnsureSuccessStatusCode();
string json = await client.GetStringAsync(apiUrl);
WeatherConditions.Rootobject weatherdetails = JsonConvert.DeserializeObject<WeatherConditions.Rootobject>(json);
forcastinfo.Text = weatherdetails.weather[0].main;
windspeedinfo.Text = weatherdetails.wind.speed.ToString();

if(weatherdetails == null)
{
Debug.WriteLine("no data");
}

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

}
}
This method is what I'm using to try and use the weather api. Im not to sure what I did wrong since there are no errors.
36 replies
CC#
Created by [ECH]JamHighlight on 3/16/2025 in #help
System.Data.OleDb reference not being acknowledged
No description
1 replies