Dataadapter update data source with dataset in C#

  • Thread starter Thread starter Bassem
  • Start date Start date
B

Bassem

I use the wizard of the data adapter and bind field to the data source
which is SQL server 2000.
I drag button on the form to save the changes in the text that showing
a field from the data source but there is no updating in the data
source.
I am very new in programming and I work with C#.
This is the code of the save button:

oleDbDataAdapter1.UpdateCommand.Parameters["EmployeeName"].Value =
textBox2.Text ;
oleDbDataAdapter1.Update(dataSet11 );

Please if there is something wrong please I want any one help me for
the saving of the changes to the database.

Bassem,
Thanks.
 
Hi Baseem,

Assuming you are binding data to (among other controls) textBox1.Text
property you should first call this:
textBox1.DataBindings["Text"].BindingManagerBase.EndCurrentEdit();

So if flushes all changes to datatable.

Then you call (no need for setting parameters):

oleDbDataAdapter1.Update(dataSet11 );
 
Back
Top