Saving changes from DataGridView into database

  • Thread starter Thread starter karim
  • Start date Start date
K

karim

I'm facing the following problem :

I created a connection to a database table by going through the "Data
Source Configuration Wizard" untill I had my tables to be shown in the
Data Sources Window.

Using the Data Sources Window I selected one of my tables called
"Phonebook" to be bound to a DataGridView.

Then I dragged the table into my Form and made sure that the dragged
DataGridView having the readonly property set to False.

Data previously entered into the table are displayed very well when I
run the application.

My problem is: when I made changes to the DataGridView control and
press the Save button it does not save these changes to the
database .... does not save changes to existing records and does not
add new records, although it accepts everything in the DataGridView
Control

it might be very basic but it does not work at all ... I need help
please

Thank you in advance
regards

Karim,
 
Hi Karim,

I think that you didn't call your adapter's Update method. If you can't call
dataadapter's Update method, no differences will set to the database.
Here is a sample code:

this.your_dataAdapter_name.Update(your_dataset_rhat_fill_the_datagrid);

Have a nice day,

Aytaç ÖZAY

MSc., MCP, Dynamics AX Technical Consultant
Microsoft Academic Software Developer Group Member
 
Back
Top