Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - update statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

update statement

 Post Reply Post Reply
Author
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post Topic: update statement
    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?
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 08 December 2003 at 2:22pm
so it's going to very happily update every record in the table
Back to Top
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.