The query should look more like this
"update mysqlcshap.Fahrzeug set Status='1';"
However, this will update
all the records in the database which is probably not what you want. You probably want to update a specific record and for that you need a WHERE clause
"update mysqlcshap.Fahrzeug set Status='1' WHERE Id=1234;"
This assumes that you have a primary key value in your table and it's name is 'Id'. Of course you need to know what the Id is in order to do this.
Sometimes you can create fields that are reserved words. I don't remember if 'Status' is one of them, but just case wrap the field names in [].
You're using ExecuteReader. This query doesn't return anything so there's nothing to read. Use ExecuteNonQuery to run a command that doesn't read.
Your connection string needs fixing (see
this. I don't see a 'Database' argument, perhaps it's the mysqlcshap?
I usually wrap my connection in a using statement. Put all that together and this is what I came up with
private void pictureBox1_Click(object sender, EventArgs e)
{
System.IO.Stream str = Properties.Resources.commander_5;
System.Media.SoundPlayer snd = new System.Media.SoundPlayer(str);
snd.Play();
label1.Text = "S1";
string constring = "datasource=123.456.678;Database=mysqlcshap;port=3306;User Id=1234;Password=1234";
string query = "update Fahrzeug set [Status]='1' WHERE Id=1234;";
using (MySqlConnection Dateneingabe = new MySqlConnection(constring))
{
MySqlCommand cmd = new MySqlCommand(query, Dateneingabe);
try
{
Dateneingabe.Open();
cmd.ExecuteNonQuery();
Dateneingabe.Close();
}
catch (Exception ex)
{
}
}
}
HTH, Mike