• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 449
  • Last Modified:

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.
0
JAMES
Asked:
JAMES
  • 2
1 Solution
 
e1vCommented:
Try calling .EndEdit() on your bindingSource before .Update()

0
 
JAMESAuthor Commented:
If you mean like this :-

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

then this doesnt work....

Anymore thoughts?
0
 
JAMESAuthor Commented:
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.
0
 
GranModCommented:
Closed, 500 points refunded.
GranMod
The Experts Exchange
Community Support Moderator of all Ages
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now