473,800 Members | 2,624 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating Database

Hello,

I have some textareas assigned some values which is taken from the
database on page_load. Also there is an update button.

But when I change the text and click the update button it does not
work. Actually it works, but the text I type in the textarea is not
recognized. It recognizes the assigned value on page_load, and updates
the same thing over itself.
Here is my code:
sqlDS.UpdateCom mand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.R eplace("'", "''") & "', diaryInfo='" &
TextBox2.Text.R eplace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.N ame & "' AND diaryDate='" &
Label4.Text & "'"
sqlDS.Update()
Label6.Text = "Great"
Thanks in advance.

Aug 14 '06 #1
3 1220
Does the Page_Load use If Not Page.IsPostBack Then?

If not, you are resetting the form in Page_Load prior to your update button
event.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"Dot Net Daddy" <ca********@gma il.comwrote in message
news:11******** *************@7 4g2000cwt.googl egroups.com...
Hello,

I have some textareas assigned some values which is taken from the
database on page_load. Also there is an update button.

But when I change the text and click the update button it does not
work. Actually it works, but the text I type in the textarea is not
recognized. It recognizes the assigned value on page_load, and updates
the same thing over itself.
Here is my code:
sqlDS.UpdateCom mand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.R eplace("'", "''") & "', diaryInfo='" &
TextBox2.Text.R eplace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.N ame & "' AND diaryDate='" &
Label4.Text & "'"
sqlDS.Update()
Label6.Text = "Great"
Thanks in advance.

Aug 15 '06 #2
No I didn't use If Not Page.IsPostBack Then ...

but I understand what you mean, however I couldnt get it into code. I
am updating the database on Button.Click event.

Maybe copying the same code in the Button_Click into Page_Load under
If Page.IsPostback would work. But the problem is there is no way to
access the page from the address bar. I mean the page is a cross page
post back from another page. So it might cause problems.

Actually would work in practice, but on first page load it updates
itself, am I right?
Cowboy (Gregory A. Beamer) wrote:
Does the Page_Load use If Not Page.IsPostBack Then?

If not, you are resetting the form in Page_Load prior to your update button
event.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"Dot Net Daddy" <ca********@gma il.comwrote in message
news:11******** *************@7 4g2000cwt.googl egroups.com...
Hello,

I have some textareas assigned some values which is taken from the
database on page_load. Also there is an update button.

But when I change the text and click the update button it does not
work. Actually it works, but the text I type in the textarea is not
recognized. It recognizes the assigned value on page_load, and updates
the same thing over itself.
Here is my code:
sqlDS.UpdateCom mand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.R eplace("'", "''") & "', diaryInfo='" &
TextBox2.Text.R eplace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.N ame & "' AND diaryDate='" &
Label4.Text & "'"
sqlDS.Update()
Label6.Text = "Great"
Thanks in advance.
Aug 15 '06 #3
No, you were right. It works fine now in If Not Page.IsPostBack clause

Thanks for your help...

Dot Net Daddy wrote:
No I didn't use If Not Page.IsPostBack Then ...

but I understand what you mean, however I couldnt get it into code. I
am updating the database on Button.Click event.

Maybe copying the same code in the Button_Click into Page_Load under
If Page.IsPostback would work. But the problem is there is no way to
access the page from the address bar. I mean the page is a cross page
post back from another page. So it might cause problems.

Actually would work in practice, but on first page load it updates
itself, am I right?
Cowboy (Gregory A. Beamer) wrote:
Does the Page_Load use If Not Page.IsPostBack Then?

If not, you are resetting the form in Page_Load prior to your update button
event.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ****
Think Outside the Box!
*************** *************** *************** ****
"Dot Net Daddy" <ca********@gma il.comwrote in message
news:11******** *************@7 4g2000cwt.googl egroups.com...
Hello,
>
I have some textareas assigned some values which is taken from the
database on page_load. Also there is an update button.
>
But when I change the text and click the update button it does not
work. Actually it works, but the text I type in the textarea is not
recognized. It recognizes the assigned value on page_load, and updates
the same thing over itself.
>
>
Here is my code:
>
>
sqlDS.UpdateCom mand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.R eplace("'", "''") & "', diaryInfo='" &
TextBox2.Text.R eplace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.N ame & "' AND diaryDate='" &
Label4.Text & "'"
sqlDS.Update()
Label6.Text = "Great"
>
>
Thanks in advance.
>
Aug 15 '06 #4

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

Similar topics

11
16235
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? 1) simply UPDATING the values for all fields in the table, whether or not any particular field has actually changed 2) running a second SELECT statement and comparing the $_POST vars to the returned values, and only UPDATING those that have...
1
2042
by: gaosul | last post by:
I am non-programming scientist and I am using a Program called Easyarticles from Synaptosoft Inc., which is based the database program Access. Unfortunately, the owner of this company has disappeared even though his website still functions. As the program requires updating, I was wondering whether anyone has any suggestions, as to what I should do. The program allows you to search a public database called PubMed. You can mark abstracts...
3
1407
by: Bucko | last post by:
How important do you guys feel locking a database is while updating/adding information? Do you do it with every app you make? Only very high volume (traffic) apps? I'm trying to decide if my app needs it.
5
2041
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
1
2467
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... mem_id integer primary key lastname nvarchar(30) firstname nvarchar(30)
3
6338
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data correctly but it is not updating or deleting the rows. What I did was, in design view, added a gridview control and added an sqldatasource control. I configured the data source to update and delete. In the gridview tasks I selected enable...
10
5689
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1) DsStudentCourse1.AcceptChanges() i'm also wondering because w/ out AcceptChanges the data is still save into the database and it is now faster.
2
2863
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to 200-300 Mb). After compacting the file shrinks back to 3-4 Mb. I have performed the following experiment. I created a test database containing only one table with two columns (Key number, Value text(50)). The table contains 10 thousands...
4
2377
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has two fields: a primary key and another holding a string. In table B there are three fields: a primary key, a foreign key (which links to the primary key in A) and other field holding a string.
1
2375
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will need updating with 'CLOSED' where necessary.) I have been trying to use the OLEDB command builder to build the statement to update the database however it is returning an error whenever I try to do this. I already have a dataset full of data, 1...
0
9694
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
9553
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
10509
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
10281
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...
0
9095
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...
0
6824
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
5612
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2953
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.