Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-19-2002, 04:40 PM   PM User | #1
details
New Coder

 
Join Date: Jul 2002
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
details is an unknown quantity at this point
Adding to cart problem (What am I missing)

What am missing in the Sub AddToOrder? When I pass a text value to productCode, it breaks the code. I have the Access DB set for text input? Any suggestions?


Sub AddToOrder(nOrderID, nProductID, nQuant, nInstall, nProductCode)
sqlText = "INSERT INTO itemsOrdered " _
& " (orderID, productID, quantity, installationtype, productCode) values " _
& " ("&nOrderID&", "&nProductID&", "&nQuant&", "&nInstall&", "&nProductCode&")"
Conn.Execute(sqlText)

End Sub


'Main program
intProdID = Request.form("intProdID")
intQuant = Request.form("intQuant")
strInstall = Request.form("strInstall")
strProductCode = Request.form("strProductCode")



set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open ConString

intOrderID = cstr(Session("orderID"))
if intOrderID = "" then
CreateNewOrder
end if

sqlText = "SELECT * FROM itemsOrdered WHERE orderID =" & intOrderID & "AND productID =" & intProdID
set rsOrder = Conn.Execute(sqlText)

if rsOrder.EOF then
txtInfo = "This item has been added to your order."
AddToOrder intOrderID, intProdID, intQuant, strInstall, strProductCode
response.redirect "reviewOrder.asp"
else
txtInfo = "This item is already in your cart. "

end if

details is offline   Reply With Quote
Old 07-19-2002, 06:34 PM   PM User | #2
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,042
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Re: Adding to cart problem (What am I missing)

Quote:
Originally posted by details

Sub AddToOrder(nOrderID, nProductID, nQuant, nInstall, nProductCode)
sqlText = "INSERT INTO itemsOrdered " _
& " (orderID, productID, quantity, installationtype, productCode) values " _
& " (" & nOrderID & ", " & nProductID & ", " & nQuant & ", "& nInstall & ", " & nProductCode & ")"
Conn.Execute(sqlText)

End Sub

You need to have spaces in there. Did that fix it?
__________________
OracleGuy
oracleguy is offline   Reply With Quote
Old 07-19-2002, 06:38 PM   PM User | #3
ecnarongi
Regular Coder

 
Join Date: Jun 2002
Location: Northern NJ
Posts: 401
Thanks: 0
Thanked 1 Time in 1 Post
ecnarongi is an unknown quantity at this point
Re: Adding to cart problem (What am I missing)

Quote:
Originally posted by details
Sub AddToOrder(nOrderID, nProductID, nQuant, nInstall, nProductCode)
sqlText = "INSERT INTO itemsOrdered " _
& " (orderID, productID, quantity, installationtype, productCode) values " _
& " ("&nOrderID&", "&nProductID&", "&nQuant&", "&nInstall&", "&nProductCode&")"
Conn.Execute(sqlText)

End Sub
I believe he needs single quotes like so: ('"&nOrderID&"', '"&nProductID&"', '"&nQuant&"', '"&nInstall&"', '"&nProductCode&"')"
__________________
true lies
ecnarongi is offline   Reply With Quote
Old 07-19-2002, 09:04 PM   PM User | #4
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,042
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
Re: Re: Adding to cart problem (What am I missing)

Quote:
Originally posted by ecnarongi


I believe he needs single quotes like so: ('"&nOrderID&"', '"&nProductID&"', '"&nQuant&"', '"&nInstall&"', '"&nProductCode&"')"
Yeah that too I missed that.
oracleguy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:32 AM.


Advertisement
Log in to turn off these ads.