I have a WPF window, where I can add a Customer to the database. Labels and Textboxes are programmaticaly added by the amount of Columns in the database table.
Now if I put some text in the textboxes, i want to save all these texts in the Database.
My Code until now is:
try {
    for (int i = 0; i < textboxes.Count; i++)
    {
        var value = textboxes[i];
        var column = labels[i];
        MySqlCommand cmd = connection.CreateCommand();
        cmd.CommandText = "INSERT INTO firmenkunden ("+column.Name+") VALUES ('"+value.Text+"')";
        cmd.ExecuteNonQuery();
    }
    MessageBox.Show("Der Firmenkunde wurde erfolgreich erstellt.");
    this.Close();
}
catch (MySqlException ex) {
    MessageBox.Show(ex.Message);
}
But this don't work. It looks like this now:

Does someone has a idea how I can do this?
 
     
     
     
     
    