473,326 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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
2 2098
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
Thanks Kevin, that solved the problem! :)

John

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rich | last post by:
Hello, On a form I have 3 textboxes, txt0, txt1, txt2 which contain all integers. I have also placed a connection component (conn), dataadapter component (da1) and dataset component (ds1) from...
10
by: Rich | last post by:
Greetings, Just starting out with .net. I have a vb.net app where I connect to an Access mdb. I use a connection component from the tool box (conn1), a data adapter component from the toolbox...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
0
by: Erik | last post by:
Why isn't my update method getting called? Pasted below is an aspx from a 1.1 application I'm working on. It has two textboxes and a button for inserting data into the database, and a datagrid...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.