Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2004, 05:29 AM
Authorized User
 
Join Date: Jul 2003
Location: Dublin, Ireland, Ireland.
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"
pb_RS.Update

pb_RS.Close
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?

Slán
~M
____
Mark
Reply With Quote
  #2 (permalink)  
Old September 29th, 2004, 09:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

A better way is to try this.
Code:
pb_SQL = "SELECT * FROM web_1 WHERE web_num= '" & SESSION("web_num") & "'"
Response.write pb_SQL
Response.end
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.
Cheers!


_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #3 (permalink)  
Old September 29th, 2004, 12:35 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Code:
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.