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.
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.
Try calling .EndEdit() on your bindingSource before .Update()
ASKER
If you mean like this :-
MyDataSet.MyTable.Rows[0]. EndEdit();
then this doesnt work....
Anymore thoughts?
MyDataSet.MyTable.Rows[0].
then this doesnt work....
Anymore thoughts?
ASKER
Here is the solution - god that was so much harder than it should have been!
this.BindingContext[MyData Set, "MyTabler"].EndCurrentEdit ();
I think it best this question is simply now closed without awarding any points.
Cheers.
James.
this.BindingContext[MyData
I think it best this question is simply now closed without awarding any points.
Cheers.
James.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.