Home All Groups Group Topic Archive Search About

Saving changes from DataGridView into database

Author
4 Feb 2007 7:30 PM
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,

Author
6 Feb 2007 1:14 PM
Aytaç ÖZAY
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

Show quote
"karim" <karim.abdulka***@gmail.com> wrote in message
news:1170617434.758095.54670@a75g2000cwd.googlegroups.com...
> 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,
>

AddThis Social Bookmark Button