Wrox Programmer Forums
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 29th, 2004, 05:29 AM
Authorized User
Join Date: Jul 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default updating table

hi all
i have the following code

Set pb_RS=Server.CreateObject("ADODB.Recordset")
pb_SQL = "SELECT * FROM web_1 WHERE web_num= '" & SESSION("web_num") & "'"
pb_RS.Open pb_SQL, objConn, , adLockOptimistic

pb_RS.Fields("web_pb").value = SESSION("Valid")
pb_RS.Fields("web_pdate").value = Date
pb_RS.Fields("webr_stage").value = "Claimed"

Set pb_RS= Nothing

and i am trying to update a record already in a table. however when this code is run it changes the values for all records in the table. any ideas whats happening?

Old September 29th, 2004, 09:49 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Try to response.write SESSION("web_num"), and see if that hold any value.

A better way is to try this.
pb_SQL = "SELECT * FROM web_1 WHERE web_num= '" & SESSION("web_num") & "'"
Response.write pb_SQL
pb_RS.Open pb_SQL, objConn, , adLockOptimistic
Now copy/paste the resulting SQL statement and execute that on query analyser and see what it results, that would give you some idea on what is going wrong. Also confirm if you are using any Loop to do your update there.

Hope that helps.

- Vijay G
Strive for Perfection
Old September 29th, 2004, 12:35 PM
Authorized User
Join Date: Jun 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts

well if i was you i would have used update query to do the job. i find it easier to work with.

pb_SQL="update web_1 set web_pb ="' & session("Valid") & "',web_pdate='" & date & "',webr_stage=""Claimed"" where web_num='" & session("web_num") & "'"
pb_RS.open pb_sql,objConn
i think this should work

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating one table with data from another table dirtdog22 Access VBA 1 January 21st, 2008 04:41 PM
Updating Table gregalb SQL Server 2000 1 June 2nd, 2007 04:39 PM
Updating table every now and then rtr1900 Classic ASP Databases 2 December 2nd, 2005 03:12 AM
Updating table Hudson40 Access VBA 6 March 23rd, 2005 12:07 PM
Instant updating of table Hudson40 Access VBA 2 January 26th, 2005 11:52 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.