title: How to update MySql Database from DataGrid on C#?
body: <p>I'm trying to update MySQL DB from DataGrid, but it isn't working. The added data is not in the database, and there are no errors, why this happens. I have been trying to solve this problem for several days now.</p>
  
  <pre><code>private void dtGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e)
          {    
          MySqlConnection conn = DBUtils.GetDBConnection();
          string table = "brands";
          string sql = "SELECT * FROM "+table;
          MySqlDataAdapter myDataAdapter = new MySqlDataAdapter(sql, conn);
          conn.Open();
          MySqlCommandBuilder myCommandBuilder = new MySqlCommandBuilder(myDataAdapter);
          myDataAdapter.InsertCommand = myCommandBuilder.GetInsertCommand();
          myDataAdapter.UpdateCommand = myCommandBuilder.GetUpdateCommand();
          myDataAdapter.DeleteCommand = myCommandBuilder.GetDeleteCommand();
          DataSet myDataSet = new DataSet();
          myDataAdapter.Fill(myDataSet, table);
          myDataAdapter.AcceptChangesDuringUpdate = true;
          myDataAdapter.Update(myDataSet, table);
          conn.Close();
      }
  </code></pre>