0
Wie Sie Daten in XAMPP phpmyadmin mysql-Datenbank von Windows-Formular-Anwendung C# speichern? Variablen mit Daten sind country1, city1, temperature1. Database Wetter und TabelleSo speichern Sie Daten in XAMPP phpmyadmin mysql-Datenbank von Windows-Formularanwendung C#
prognostizierttry
{
string MyConnection2 = "datasource=localhost;port=3307;username=db1;password=db12121";
string Query = "insert into weather.forecast(country, city, temperature) values('" + country1 + "','" + city1 + "','" + temperature "');";
MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2);
MySqlDataReader MyReader2;
MyConn2.Open();
MyReader2 = MyCommand2.ExecuteReader();
MessageBox.Show("Save Data");
while (MyReader2.Read())
{
}
MyConn2.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}