New to 2.0 question: How do you make a DataGridView comit changes?

  • Thread starter Thread starter RMZ
  • Start date Start date
R

RMZ

Using the Visual Studio.NET 2005 designer, I have a grid bound data a
DataBindingSource, no code was written, I just used the VS.NET provided
tools to set up three columns and I have the DataGridView acting by
default so I can delete rows and edit the contents of the grid.

To perform the update/comit to the database, I put a new button on the
form when it's clicked I call
dataGridView1.EndEdit(); this does not update the database.

Is there anything more I should be doing?

The database in this case is a Microsoft Access database. Using OleDb.
 
Hi,

RMZ said:
Using the Visual Studio.NET 2005 designer, I have a grid bound data a
DataBindingSource, no code was written, I just used the VS.NET provided
tools to set up three columns and I have the DataGridView acting by
default so I can delete rows and edit the contents of the grid.

To perform the update/comit to the database, I put a new button on the
form when it's clicked I call
dataGridView1.EndEdit(); this does not update the database.

Is there anything more I should be doing?

Validate();
yourBindingSource.EndEdit();
yourTableAdapter.Update(yourDataSet.yourDataTable);

If you use the Data Sources window ( Menu->Data->Show Data Sources ) and
then drag a DataSource on the Form it will create all required code.

HTH,
Greetings
 
Back
Top