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

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.
 
B

Bart Mermuys

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top