Print Page | Close Window

update statement

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7928
Printed Date: 30 March 2026 at 7:27am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: update statement
Posted By: cuedog
Subject: update statement
Date Posted: 07 December 2003 at 8:18pm
This update statement does not have any errors, but the last field does not update the field in the database. I have response.write the statement and the data is correct. It is an update statement without a where clause. Here is the statement
 
sqlUpdate = "Update site_config SET " _
 & "letterSubject = '" & strSubject & "'," _
 & "txtHeader = '" & strtxtHeader & "'," _
 & "htmlHeader = '" & strhtmlHeader & "';"
 
Can anyone help?


-------------
http://www.512ryders.com - 512 Ryders



Replies:
Posted By: Mart
Date Posted: 08 December 2003 at 12:55am
Its easier to see the problem when you write it out on a line:

"Update site_config SET letterSubject='x' txtHeader='x' htmlHeader='x';"

And as you can see there is no WHERE statement e.g.

"Update site_config SET letterSubject='x' txtHeader='x' htmlHeader='x' WHERE ID=" & request.querystring("ID")

At the minute you arnt telling it which record to update.

Mart.


Posted By: pmormr
Date Posted: 08 December 2003 at 2:22pm
so it's going to very happily update every record in the table

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: cuedog
Date Posted: 09 December 2003 at 12:04am
So I just want to ask, in this particular table it is only for web site settings. There is only one record and there is no primary key with an autonumber.
Do you still have to have a where clause?
 
What if you wanted to update an entire field?


-------------
http://www.512ryders.com - 512 Ryders


Posted By: pmormr
Date Posted: 09 December 2003 at 1:51pm
your fine if you only have one record... but it's good practice to include it. If you forget it on a higher end project with say 4000 records you're screwed

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net