473,387 Members | 1,890 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,387 software developers and data experts.

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.UpdateCommand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.Replace("'", "''") & "', diaryInfo='" &
TextBox2.Text.Replace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.Name & "' AND diaryDate='" &
Label4.Text & "'"
sqlDS.Update()
Label6.Text = "Great"
Thanks in advance.

Aug 14 '06 #1
3 1201
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********@gmail.comwrote in message
news:11*********************@74g2000cwt.googlegrou ps.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.UpdateCommand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.Replace("'", "''") & "', diaryInfo='" &
TextBox2.Text.Replace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.Name & "' 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********@gmail.comwrote in message
news:11*********************@74g2000cwt.googlegrou ps.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.UpdateCommand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.Replace("'", "''") & "', diaryInfo='" &
TextBox2.Text.Replace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.Name & "' 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********@gmail.comwrote in message
news:11*********************@74g2000cwt.googlegrou ps.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.UpdateCommand = "UPDATE Blogs SET diaryHeader='" &
TextBox1.Text.Replace("'", "''") & "', diaryInfo='" &
TextBox2.Text.Replace("'", "''") & "', lastUpdate='" & Today.Now & "'
WHERE userName='" & User.Identity.Name & "' 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
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
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...
3
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...
5
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...
1
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... ...
3
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...
10
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)...
2
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...
4
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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,...

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.