title: Problems submitting DataGridView changes with Linq-to-SQL
body: <p>I'm trying to implement database value edition through a <code>DataGridView</code> control but honestly I'm having a hard time trying to accomplish that. I'm basically using LINQ-to-SQL classes and events, the following being the most significant snippets:</p>
  
  <pre><code>var data =  from q in data.FOOBARS
              select new
              {
                  ID = q.FOOBAR_ID,
                  LOREM = q.FOOBAR_LOREM,
                  IPSUM = q.FOOBAR_IPSUM
              };
  
  DataGridView grid = new DataGridView();
  grid.DataSource = data;
  
  // grid EVENTS     
  private void grid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
  {
      this.grid.CurrentCell.ReadOnly = false;
      this.grid.BeginEdit(true);
  }
  
  private void grid_CellLeave(object sender, DataGridViewCellEventArgs e)
  {
      if (this.grid.CurrentCell.IsInEditMode)
      {   
          // METHOD CALL            
          this.SetVariableValue(this.grid.CurrentRow.Cells["ID"].Value.ToString(), this.grid.CurrentCell.OwningColumn.Name, this.grid.CurrentCell.FormattedValue.ToString(), this.grid.CurrentCell.EditedFormattedValue.ToString());
      }
  
      this.grid.CommitEdit(DataGridViewDataErrorContexts.Commit);
      this.grid.EndEdit();
  }
  
  // METHOD IMPL
  private void SetVariableValue(string id, string type, string current, string edited)
  {
      try
      {
          if (current != edited)
          {
              using (FOOBARDataClassesDataContext data = new FOOBARDataClassesDataContext(this.BuildConnection()))
              {
                  data.ExecuteCommand("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED");
  
                  switch (type)
                  {
                      case "LOREM":
                          var currentLorem = data.FOOBARS.SingleOrDefault(v =&gt; v.FOOBAR_ID == Convert.ToInt32(id)).FOOBAR_LOREM;
                          currentLorem = edited;
                          data.SubmitChanges(ConflictMode.ContinueOnConflict);
                          break;
  
                      case "IPSUM":
                          var currentIpsum = data.FOOBARS.SingleOrDefault(v =&gt; v.FOOBAR_ID == Convert.ToInt32(id)).FOOBAR_IPSUM;
                          currentIpsum = edited;
                          data.SubmitChanges(ConflictMode.ContinueOnConflict);
                          break;
  
                      default:
                          break;
                  }
                  data.Refresh(RefreshMode.OverwriteCurrentValues);
              }
          }
      }
      catch (Exception error)
      {
          if (logger.IsErrorEnabled) logger.Error(error.Message);
      }
  }
  </code></pre>
  
  <p>Debugging looks good, objects are actually being updated but for some reason changes are neither being submitted nor updated.</p>
  
  <p>Any help would be certainly appreciated. Thanks much you guys in advance!</p>