By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,200 Members | 1,755 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,200 IT Pros & Developers. It's quick & easy.

DataAdapter.Update works w/ datagrid but not w/ textboxes

P: n/a
I have a very simple application where i just want to display records
from a database, and be able to edit the records.

Here's the code for the "update" button:

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnUpdate.Click
DA.Update(DataSet, "mytable")
End Sub

If I display the records in a DATAGRID, and edit a record and then
click my Update button, it updates perfectly.

However, if i bind the data to a series of textboxes, the Update button
does not work.

I actually made a form that included both a datagrid and textboxes
(displaying the same data). For some reason, the Update would just not
work when edited from a textbox.

Note: the DataAdapter and connection were created using the IDE, so i
didn't need to create a commandbuilder. The updatecommand.commandtext
was created automatically when i created the DataAdapter.

Any help w/ this problem will be greatly appreciated!

Thanks!
John

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Make sure in your update button event, that you End the current edit.
Add
BindingContext(DataSet.Tables(0)).EndCurrentEdit()
Before you do the DataAdapter.Update

"johnb41" <or****@informatik.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I have a very simple application where i just want to display records
from a database, and be able to edit the records.

Here's the code for the "update" button:

Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnUpdate.Click
DA.Update(DataSet, "mytable")
End Sub

If I display the records in a DATAGRID, and edit a record and then
click my Update button, it updates perfectly.

However, if i bind the data to a series of textboxes, the Update button
does not work.

I actually made a form that included both a datagrid and textboxes
(displaying the same data). For some reason, the Update would just not
work when edited from a textbox.

Note: the DataAdapter and connection were created using the IDE, so i
didn't need to create a commandbuilder. The updatecommand.commandtext
was created automatically when i created the DataAdapter.

Any help w/ this problem will be greatly appreciated!

Thanks!
John

Nov 21 '05 #2

P: n/a
Thanks Kevin, that solved the problem! :)

John

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.