473,785 Members | 2,789 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Databound Textbox - DataSet not getting updated value

I have one databound TextBox on a page with one button. The TextBox loads
the correct SQL record data but typing a new string into the Textbox fails
to change the DataSet. Any ideas? There must be some way to force the
edited TextBox to update the DataSet since it appears to not be done
automatically.

//--------------------------------------------------------------------------
--------------------------
private void Page_Load(objec t sender, System.EventArg s e)
{
sqlDataAdapter1 .Fill(dataSet21 );
Page.DataBind() ;
}
//--------------------------------------------------------------------------
--------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
//dataSet21.Accep tChanges();
DataSet ds = dataSet21.GetCh anges();
sqlDataAdapter1 .Update(dataSet 21);
}
//--------------------------------------------------------------------------
--------------------------
Nov 18 '05 #1
4 2579
Where are you taking the data from the textbox and placing it into the
dataset?
"John Rose" <jo*******@yaho o.com> wrote in message
news:Ob******** ******@TK2MSFTN GP09.phx.gbl...
I have one databound TextBox on a page with one button. The TextBox loads
the correct SQL record data but typing a new string into the Textbox fails
to change the DataSet. Any ideas? There must be some way to force the
edited TextBox to update the DataSet since it appears to not be done
automatically.

//-------------------------------------------------------------------------- --------------------------
private void Page_Load(objec t sender, System.EventArg s e)
{
sqlDataAdapter1 .Fill(dataSet21 );
Page.DataBind() ;
}
//-------------------------------------------------------------------------- --------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
//dataSet21.Accep tChanges();
DataSet ds = dataSet21.GetCh anges();
sqlDataAdapter1 .Update(dataSet 21);
}
//-------------------------------------------------------------------------- --------------------------

Nov 18 '05 #2
How do you do that?

Actually the Button1_Click event is:
//---------------------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
sqlDataAdapter1 .Update(dataSet 21);
}
//---------------------------------------
"Scott M." <s-***@BADSPAMsnet .net> wrote in message
news:el******** ******@TK2MSFTN GP12.phx.gbl...
Where are you taking the data from the textbox and placing it into the
dataset?
"John Rose" <jo*******@yaho o.com> wrote in message
news:Ob******** ******@TK2MSFTN GP09.phx.gbl...
I have one databound TextBox on a page with one button. The TextBox loads the correct SQL record data but typing a new string into the Textbox fails to change the DataSet. Any ideas? There must be some way to force the
edited TextBox to update the DataSet since it appears to not be done
automatically.

//--------------------------------------------------------------------------
--------------------------
private void Page_Load(objec t sender, System.EventArg s e)
{
sqlDataAdapter1 .Fill(dataSet21 );
Page.DataBind() ;
}

//--------------------------------------------------------------------------
--------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
//dataSet21.Accep tChanges();
DataSet ds = dataSet21.GetCh anges();
sqlDataAdapter1 .Update(dataSet 21);
}

//--------------------------------------------------------------------------
--------------------------


Nov 18 '05 #3
You've got to place the text value into the dataset column for a given
row...

DataSet.Tables( "tableName").Ro ws(whichRowToWo rkWith).Item("c olumnName") =
textbox.text

You also need to make sure your DataAdapter has a valid (and correct)
update, delete and insert statement associated with its commands.

The fact that the textbox is bound does not mean that if you change its
value the dataset will immediately change, you have to manually update the
dataset with the value from the textbox.

"John Rose" <jo*******@yaho o.com> wrote in message
news:eU******** ******@TK2MSFTN GP10.phx.gbl...
How do you do that?

Actually the Button1_Click event is:
//---------------------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
sqlDataAdapter1 .Update(dataSet 21);
}
//---------------------------------------
"Scott M." <s-***@BADSPAMsnet .net> wrote in message
news:el******** ******@TK2MSFTN GP12.phx.gbl...
Where are you taking the data from the textbox and placing it into the
dataset?
"John Rose" <jo*******@yaho o.com> wrote in message
news:Ob******** ******@TK2MSFTN GP09.phx.gbl...
I have one databound TextBox on a page with one button. The TextBox loads the correct SQL record data but typing a new string into the Textbox fails to change the DataSet. Any ideas? There must be some way to force the edited TextBox to update the DataSet since it appears to not be done
automatically.

//--------------------------------------------------------------------------
--------------------------
private void Page_Load(objec t sender, System.EventArg s e)
{
sqlDataAdapter1 .Fill(dataSet21 );
Page.DataBind() ;
}

//--------------------------------------------------------------------------
--------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
//dataSet21.Accep tChanges();
DataSet ds = dataSet21.GetCh anges();
sqlDataAdapter1 .Update(dataSet 21);
}

//--------------------------------------------------------------------------
--------------------------



Nov 18 '05 #4
Thanks. Looks like in C# I have to do:

private void Button1_Click(o bject sender, System.EventArg s e)
{
dataSet21.Table s["tablename"].Rows[intRow].BeginEdit();
dataSet21.Table s["tablename"].Rows[intRow]["columnname "] = textbox.Text;
dataSet21.Table s["tablename"].Rows[intRow].EndEdit();
sqlDataAdapter1 .Update(dataSet 21);
}
"Scott M." <s-***@BADSPAMsnet .net> wrote in message
news:ug******** ******@TK2MSFTN GP09.phx.gbl...
You've got to place the text value into the dataset column for a given
row...

DataSet.Tables( "tableName").Ro ws(whichRowToWo rkWith).Item("c olumnName") =
textbox.text

You also need to make sure your DataAdapter has a valid (and correct)
update, delete and insert statement associated with its commands.

The fact that the textbox is bound does not mean that if you change its
value the dataset will immediately change, you have to manually update the
dataset with the value from the textbox.

"John Rose" <jo*******@yaho o.com> wrote in message
news:eU******** ******@TK2MSFTN GP10.phx.gbl...
How do you do that?

Actually the Button1_Click event is:
//---------------------------------------
private void Button1_Click(o bject sender, System.EventArg s e)
{
sqlDataAdapter1 .Update(dataSet 21);
}
//---------------------------------------
"Scott M." <s-***@BADSPAMsnet .net> wrote in message
news:el******** ******@TK2MSFTN GP12.phx.gbl...
Where are you taking the data from the textbox and placing it into the
dataset?
"John Rose" <jo*******@yaho o.com> wrote in message
news:Ob******** ******@TK2MSFTN GP09.phx.gbl...
> I have one databound TextBox on a page with one button. The TextBox

loads
> the correct SQL record data but typing a new string into the Textbox

fails
> to change the DataSet. Any ideas? There must be some way to force the > edited TextBox to update the DataSet since it appears to not be done
> automatically.
>
>

//--------------------------------------------------------------------------
> --------------------------
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> sqlDataAdapter1 .Fill(dataSet21 );
> Page.DataBind() ;
> }
>

//--------------------------------------------------------------------------
> --------------------------
> private void Button1_Click(o bject sender, System.EventArg s e)
> {
> //dataSet21.Accep tChanges();
> DataSet ds = dataSet21.GetCh anges();
> sqlDataAdapter1 .Update(dataSet 21);
> }
>

//--------------------------------------------------------------------------
> --------------------------
>
>



Nov 18 '05 #5

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

Similar topics

13
4337
by: Paul Slavin | last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this?? any answers appreciated, as to due to the underlying structure of the datasets, i.e lots of child tables etc, I cannot use bindingcontext
7
2239
by: Peter D.C. | last post by:
Hi I want to update data hold in several textbox controls on an asp.net form. But it seems like it is the old textbox values that is "re-updates" through a stored procedure who updates a SQL tabel. I know the SP works, because a smalldatetime-field in the database is changed. I've tried to disable viewstate on all textbox controls. Any ideas to solve this problem.
6
2418
by: Frank | last post by:
Hopefully this is the correct group for this message. My previous post to (I assume) a non-.net group was not welcomed. I have a form with 7 text boxes that are all bound to fields of a dataset. The form also contains a datagrid also bound to the same dataset. I have a button on the form to update the data to the source.
6
13951
by: JohnR | last post by:
I have a table with 1 row which is used to hold some application wide items (one item per field, hence I only need 1 row). I want to bind one of the fields to a textbox. After setting up the oledbconnection and dataAdapter and filling the DataSet (ds) I tried this: TextBox1.DataBindings.Add("text", ds.Tables.Item("MyFile"), "MyField") I then put the following code in the SAVE button click event:
0
1506
by: Benny Dein | last post by:
Hi A newbie question regarding using update function on sqldataadapter: I have created a connection, a dataadapter and a dataset on my webform. I have put a texbox on my webform to show a value from a certain field on a selected record. The textbox is databound to my datatable and shows as wanted the value in the sql selected row.
4
2107
by: news.microsoft.com | last post by:
Hello, I have two databound radiobuttons which have advanced databinding properties of onpropertychanged enabled so that I can raise the columnchanged event whenever the radiobuttons are changed. In the columnchanged event I am simply accepting changes into the dataset. There is no dataadapter because it is a standalone dataset. When one radiobutton is already checked (as opposed to neither) and I select
3
5424
by: Jeff | last post by:
hey asp.net 2.0 I want to programmatically populate (with data from the database) a label control in a FormView on a webpage. Is it a good idea to put my logic inside the DataBound event of the FormView?
0
2205
by: morathm | last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at the web service, with a web reference to those datasets via exposed s on the web service. The client app has a series of windows forms designed to manage particular types of data. For example, there's a manage users form. On each of these...
0
2513
by: Mike | last post by:
So here's the situation (.NET 2.0 btw): I have a form, and on this form is a textbox among many other databound controls. The textbox is bound to a field in a data table via the Text property. In this table there are multiple columns that cannot be NULL, which, are bound to other controls (but they're not really important at this time). I create a new row via the currency manager like so: _currencyManager.AddNew() _currentRow =...
0
9645
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...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10092
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
9950
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
6740
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
5381
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...
1
4053
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.