Newbie Helo - Datarow.EndEdit

  • Thread starter Thread starter Daniel Jeffrey
  • Start date Start date
D

Daniel Jeffrey

Can someone please help me.

I have created a simple form.

3 Controls - ID, Firstname and Lastname.

I have added a SqlDataadapter, Dataset etc etc.

When I call Fill(Dataset) it all works fine.

I can edit the values on the screen but when I post nothing happens unless I
call EndEdit.

Examples below.

**FAILS - HasChanges is False! - Message Box shows the correct UPDATED
Values.**

MessageBox.Show(dsEmployees1.Employees.Rows[0]["LastName"].ToString());
if (!dsEmployees1.HasChanges())
return;
sqlDataAdapter1.Update(dsEmployees1, "Employees");


**WORKS**
dsEmployees1.Employees.Rows[0].EndEdit();
if (!dsEmployees1.HasChanges())
return;
sqlDataAdapter1.Update(dsEmployees1, "Employees");


Surely I don't have to find the row I am on, and call EndEdit all the time?

Maybe I am doing it all wrong? My Dataset in this instance will only every
have 1 row and in most cases only 1 table, should I be doing this another
way?

I want to use binding however and not manually get the values from the
controls.

Any help would be GREATLY appreciated.

Thanks
Daniel Jeffrey
 
Daniel,

You should just need to call EndEdit on your BindingSource object, not on
the row in the datatable.

Kerry Moorman
 
Back
Top