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 February 15th, 2004, 08:02 PM
photoshop_god photoshop_god is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 322 photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 21 h 36 m 51 sec
Reputation Power: 6
problem with sql statement

Hi,

I have been trying to get this to work all afternoon with no luck. I know I'm missing something obviouse but I'm new to SQL statements.

I'm trying to update a field in a access database everytime some access it. Here is the code I have sofar:

<%
Dim iBidNeeded

sCMD = RequestValue("CMD")
sUserName = "" & RequestValue("UserName")
sPassword = "" & RequestValue("Password")
iBidPlaced = FVal(RequestValue("Bid"))
lItemID = FVal(RequestValue("ItemID"))

*** THIS IS THE STATEMENT I'M HAVING TROUBLES WITH ***
sSQL = "UPDATE tblQAAuctions SET aucHits = aucHits + 1 WHERE aucID = " & Request("aucID")


DoPageHeader
OpenDBConn

gsSQL = "SELECT aucEnded,aucHits,aucEmailsSent,aucItemOwner,aucIte mTitle,aucCategoryID,aucImageURL," & _
"aucAvailDate,aucCloseDate,aucStartingBid,aucMinimu mIncrement,aucCurrentBid,aucCurrentBidder,aucDescr iption," & _
"regUserName, regEmail, regCity, regState, regCountry " & _
"FROM tblQAAuctions LEFT JOIN tblQARegistration on tblQAAuctions.aucItemOwner = tblQARegistration.regID " & _
"WHERE aucID = " & SQLVal(lItemID)
Set rs = gobjConnect.Execute(gsSQL)

Thanks in advance for any help.

Reply With Quote
  #2  
Old February 15th, 2004, 09:04 PM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
Are you getting any errors? I did notice this:

'aucDescr iption'

You have a space in there.

Reply With Quote
  #3  
Old February 16th, 2004, 09:38 AM
photoshop_god photoshop_god is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 322 photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level)photoshop_god User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 21 h 36 m 51 sec
Reputation Power: 6
Hi Dcarva,

I realize after reading the post again that my description was kind of vague. Sorry.

The space happened when I copy and pasted the code in here. That bit of the code works fine. The sql statement that I'm having problems with is this:

sSQL = "UPDATE tblQAAuctions SET aucHits = aucHits + 1 WHERE aucID = " & Request("aucID")

What I'm doing is I have an auction site that runs off of an access database. (It's a small site!) I have a page called viewitem.asp that displays the detailed information for a given product. What this statement above will and should do is act as a hit counter. I have a table called tblQAAuctions and a field called aucHits wich stores all of the hits an item receives. aucID is the id for each auction. I have set the aucHits field to text and set a default value to 0.

I'm not gettng any error messages. It's also not adding any hits to the database. It would be great if I did get an error message, at least I could then fix it. I'm relatively new to sql statements and have been scratching my head for the past day or so. I'll include the top part of the code from the viewitem.asp page with the sql statement from above:

<%
Dim iBidNeeded

sCMD = RequestValue("CMD")
sUserName = "" & RequestValue("UserName")
sPassword = "" & RequestValue("Password")
iBidPlaced = FVal(RequestValue("Bid"))
lItemID = FVal(RequestValue("ItemID"))


sSQL = "UPDATE tblQAAuctions SET aucHits = aucHits + 1 WHERE aucID = " & Request("aucID")


DoPageHeader
OpenDBConn

gsSQL = "SELECT aucEnded,aucEmailsSent,aucItemOwner,aucIte mTitle,aucCategoryID,aucImageURL," & _
"aucAvailDate,aucCloseDate,aucStartingBid,aucMinimu mIncrement,aucCurrentBid,aucCurrentBidder,aucDescr iption," & _
"regUserName, regEmail, regCity, regState, regCountry " & _
"FROM tblQAAuctions LEFT JOIN tblQARegistration on tblQAAuctions.aucItemOwner = tblQARegistration.regID " & _
"WHERE aucID = " & SQLVal(lItemID)
Set rs = gobjConnect.Execute(gsSQL)

Thanks again for any help.

Last edited by photoshop_god : February 16th, 2004 at 09:41 AM.

Reply With Quote
  #4  
Old February 16th, 2004, 10:49 AM
dcarva's Avatar
dcarva dcarva is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Jan 2003
Location: USA
Posts: 633 dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level)dcarva User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 9 h 18 m 20 sec
Reputation Power: 6
1) Are you executing the "sSQL" update query? I don't see in your code that you are executing that query. You do execute the "gsSQL" query.

2) Other considerations: are you getting the right value with Request("auctID")? Do a Response.Write(Request("auctID")) to make sure that you are getting the right value.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > problem with sql statement


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 4 hosted by Hostway
Stay green...Green IT