|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
Are you getting any errors? I did notice this:
'aucDescr iption' You have a space in there. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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. |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > problem with sql statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|