473,657 Members | 2,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataAdapter.Upd ate 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.EventArg s) Handles btnUpdate.Click
DA.Update(DataS et, "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.c ommandtext
was created automatically when i created the DataAdapter.

Any help w/ this problem will be greatly appreciated!

Thanks!
John

Nov 21 '05 #1
2 2111
Make sure in your update button event, that you End the current edit.
Add
BindingContext( DataSet.Tables( 0)).EndCurrentE dit()
Before you do the DataAdapter.Upd ate

"johnb41" <or****@informa tik.com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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.EventArg s) Handles btnUpdate.Click
DA.Update(DataS et, "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.c ommandtext
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
1364
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 the toolbox on to the form. I established a connection to an Access mdb file and can display data correctly on the form in the textboxes. The textboxes are bound to columns in the dataset. So the only code I have to populate the form is on...
10
1449
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 (da1) and create a typed dataset (ds1) and populate a grid on a form (grd1). This all works fine and I can see data from the Access mdb in the grid. But now I want to add a record to the mdb.
11
2237
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 reflect that the 3 items have been deleted only to discover that the 3 items appear, however when I click on them to display their information which runs a datareader over the same database it appears that the data has now gone. I wondered whether...
0
1747
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 for editing and deleting data. When a user clicks on the "Edit" button in the datagrid, Edit() method is called and the appropriate row is changed into textboxes. And if user clicks on the "Update" button, the Update() method is fired. But if...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.