0
votes

I have a DataGridView. It uses a BindingSource, a DataTable in a DataSet, and a TableAdapter to add/change/delete data in a table. It worked OK, but stopped working when I added a field/column, and I can't figure out what I did or how fix it.

The user can add a new row at the bottom of the DataGridView, but when he goes to save, the row disappears and is not saved. In addition, if he tries to type a second new row, the first new row disappears.

Existing Rows can be changed and saved back to the database successfully.

I've been asked for code. OK, here is code. (I've eliminated some error checking done by scanning dtDep) The point that after the third line is executed, there are no rows in dtDep even though a new row had been entered into the DataGridView. If a row had been retrieved, it would be in dtDep and the database table updated by the last statement.

  this.Validate();
  bsBelkDep.EndEdit();
  DataTable dtDep = dsBelk.Tables["belk_elig_dep"];
  int n = belk_elig_depTableAdapter.Update(this.dsBelk.belk_elig_dep);
1
Could you provide some code?lemunk
I'm not sure what code I could provide. The question is about the behavior of the DGV at execution time.phv3773
For starters.. the code that saves the datalogixologist

1 Answers

0
votes

It was a problem with the DataGridView, but I don't know what. I started deleting and re-creating the various object, and after the I recreated the DataGridView, it worked OK. Which was a pain because I have to do significant reformatting, but at least it works.