SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 9th, 2003, 01:39 PM
peachsoda03 peachsoda03 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 10 peachsoda03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Only First Record Updating

Hello,

For some reason I am having troubles getting my database to update a specific record. I do not receive any errors, but my when I download my database from the server, it shows the first record updated, not the specific record. Any suggestions? My code is as follows:

Code:

dim i, purchasinguse, eacrid
i = 1
purchasinguse = Request.Form("purchasinguse" & i)
eacrid = Request.Form("eacrID")

bsql = "SELECT * FROM ItemDetails WHERE ID = " & eacrid
rs2.open bsql, conn, adOpenDynamic, adLockReadOnly, adCmdText

rs.open "Eacr", conn, adOpenKeySet, adLockOptimistic, adCmdTable
rs.update

	rs("PurchasingUseID") = purchasinguse
    rs("PurchasingUseDate") =   Request.Form("puse_date")

rs.update
rs.close


Thanks!

Last edited by peachsoda03 : December 11th, 2003 at 01:37 PM.

Reply With Quote
  #2  
Old December 11th, 2003, 12:08 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Are you sure that you aren't a least updating the first record in the table?

S-

Reply With Quote
  #3  
Old January 22nd, 2004, 03:25 PM
peachsoda03 peachsoda03 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 10 peachsoda03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Aye, I have finally figured out how to get the two fields (purchasinguseID & purchasinguseDate). However, only the first record is updated, rather than the specified record (Ex: Form #43). I have NO clue what is wrong with my code....

Code:

dim i
i = 1

asql = "SELECT ID FROM EACR WHERE ID = " & Request.Form("eacrID")
rs.open "Eacr", conn, adOpenKeySet, adLockOptimistic, adCmdTable
rs.update

rs("PurchasingUseID") =   Request.Form("purchasinguse" & i)
rs("PurchasingUseDate") =   Request.Form("puse_date")

    rs.update
    rs.close


Any help is *greatly* appreciated!

Reply With Quote
  #4  
Old January 26th, 2004, 11:32 AM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
Fix the following statement

asql = "SELECT ID FROM EACR WHERE ID = " & Request.Form("eacrID")


SHOULD BE

asql = "SELECT PurchasingUseID, PurchasingUseDate FROM EACR WHERE ID = " & Request.Form("eacrID")


Also fix the next statement

rs.open "Eacr", conn, adOpenKeySet, adLockOptimistic, adCmdTable

SHOULD BE
rs.open asql, conn, adOpenKeySet, adLockOptimistic, adCmdTable

Reply With Quote
  #5  
Old January 26th, 2004, 03:23 PM
peachsoda03 peachsoda03 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 10 peachsoda03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ah ha! Thanks so much for your help!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > DB Not Updating


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT