Link to home
Start Free TrialLog in
Avatar of JAMES
JAMES

asked on

Databound TextBox not updating underlying database

This is related to another question I have outstanding but I will keep this as a new question also.

I have a data adapter with an associated dataset on my windows form.  I also have a text box that has it's "databindings.text" property set to the correct column in my table (all done from the property editor, not code).

I .fill this dataset and, sure enough, the textbox gets populated.  I then simply edit the data in the textbox and in the edtFolder_Leave event i perform a .update but... nothing gets updated.  I have checked the update sql server code in the update property and all this looks fine.

Why does my underlying data in my sql server table not get updated?

What am I missing?

Many thanks.

James.
Avatar of e1v
e1v

Try calling .EndEdit() on your bindingSource before .Update()

Avatar of JAMES

ASKER

If you mean like this :-

MyDataSet.MyTable.Rows[0].EndEdit();

then this doesnt work....

Anymore thoughts?
Avatar of JAMES

ASKER

Here is the solution - god that was so much harder than it should have been!

this.BindingContext[MyDataSet, "MyTabler"].EndCurrentEdit();

I think it best this question is simply now closed without awarding any points.

Cheers.

James.
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial