This problem has been bugging me for a while now. Whenever the qty in the cart is updated with the qty, the "Cannot display the page" message is returned.
Also, my company's website shoppingcart works for certain customers who have made purchases before, not for others even though they are logged in and ready to make purchase. Basically the items from the shopping cart are not shown up in the checkout page when. I am a newbie to ASP and currently a new maitainer of the website. Your help will be greatly appreciated.
My recalc.asp code:
<% Response.Buffer = True
Set ConnObj = Server.CreateObject("ADODB.Connection")
ConnObj.Mode = adModeWrite
' ConnObj.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("../../database/invatec.mdb")
ConnObj.Open "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
for i = 1 to request.form("itemcnt")
if request.form("Quantity" & i ) > "" and isnumeric(request.form("Quantity" & i )) and request("onhand" & i ) > "" and isnumeric(request("onhand" & i )) then
newqty = cint(request("Quantity" & i ))
onhand = cint(request("onhand" & i ))
if newqty > onhand then
newqty = onhand
end if
neworder = request.form("Order" & i)
CommandText = "UPDATE [Order] SET [Order].Quantity = " & newqty
if request("cost_bid"& i)>"" and isnumeric(request("cost_bid"& i)) then
CommandText=CommandText & ", Cost_Bid=" & request("cost_bid"& i)
if request("cost_bid"& i) >= request("cost"& i) then
CommandText=CommandText & ", status='Shopping' "
end if
end if
CommandText=CommandText & " WHERE (((Order.OrderID)= " & neworder & "))"
'response.write (CommandText)
ConnObj.Execute(CommandText)
end if
next
response.redirect("/cart.asp")
%>
My cart.asp code:
<% DBPath = "../database/invatec.mdb" %>
<!--#include virtual="/modules/checksession.asp"-->
<%
Response.Expires=0
%>
<%
' invconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("../database/invatec.mdb")
invconn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
Set rsInvatec3 = Server.CreateObject ("ADODB.Recordset")
SQLstr3="Select * From [Order] Where (Status='Shopping' or Status='Bid') and BuyerID=" & Session("CustomerID") & " order by vendor"
rsInvatec3.Open SQLstr3, invconn, 0, 1
if not(rsInvatec3.EOF or rsInvatec3.BOF) then
TotalCost = 0
SubTotal = 0
cntr = 1
do while not rsInvatec3.EOF
SubTotal = (rsInvatec3("Cost") * rsInvatec3("Quantity"))
TotalCost = TotalCost + SubTotal
%>
My checksession.asp code:
<!-- #include virtual="/adovbs.inc" -->
<%
response.Expires=0
response.buffer = true
' check for session variables[done]
' if they exist then move on
if not Session("ID")>"" or request("Login") > "" then
if Request.Cookies("SavedLogin")("ID")>"" then ' was here before
UserID=Request.Cookies("SavedLogin")("ID")
Password=Request.Cookies("SavedLogin")("Pass")
end if
if request("Login") > "" then ' logged in from screen
UserID=request("Login")
Password=request("Password")
end if
if Session("regLogin") > "" and Session("regPassword") > "" then
UserID = Session("regLogin")
Password = Session("regPassword")
Session("regLogin") = ""
Session("regPassword") = ""
end if
if UserID > "" and Password > "" then
' Conn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath( DBPath )
Conn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
Set rsPassword = Server.CreateObject ("ADODB.Recordset")
SQLstr="Select * from Customers where Status='Active' and UserID='" & UserID & "' and Password='" & Password & "'"
' rsPassword.Open SQLstr, Conn, 3, 3
rsPassword.Open SQLstr, Conn, adOpenStatic, adLockReadOnly
if rsPassword.RecordCount > 0 then
' set session variables
Session("ID") = UserID
Session("Pass") = Password
Session("CompanyName") = rsPassword("Customer")
Session("CustomerID") = rsPassword("CustomerID")
Session("IDTMember") = rsPassword("IDTMember")
Session("UserLoggedIn") = true
' set cookies
Response.Cookies("SavedLogin")("ID") = UserID
Response.Cookies("SavedLogin")("Pass") = Password
Response.Cookies("SavedLogin").Expires = Date + 30
else
Session("Message") = "<br><img src='/img/transupply.gif' width='4' height='4' border='0'>Incorrect Login/Password"
response.redirect ("/register.asp")
end if
rsPassword.Close
set rsPassword = Nothing
else
Session("UserLoggedIn") = false
end if
end if
if Session("UserLoggedIn") = true then
' invconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath( DBPath )
invconn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
Set rsInvatec3 = Server.CreateObject ("ADODB.Recordset")
SQLstr3="Select * From [Order] Where (Status='Shopping' or Status='Bid') and BuyerID=" & Session("CustomerID") & " order by vendor"
rsInvatec3.Open SQLstr3, invconn, 0, 1
if not(rsInvatec3.EOF or rsInvatec3.BOF) then
Session("CartItems") = true
else
Session("CartItems") = false
end if
rsInvatec3.Close
set rsInvatec3 = Nothing
end if
%>
Also, my company's website shoppingcart works for certain customers who have made purchases before, not for others even though they are logged in and ready to make purchase. Basically the items from the shopping cart are not shown up in the checkout page when. I am a newbie to ASP and currently a new maitainer of the website. Your help will be greatly appreciated.
My recalc.asp code:
<% Response.Buffer = True
Set ConnObj = Server.CreateObject("ADODB.Connection")
ConnObj.Mode = adModeWrite
' ConnObj.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("../../database/invatec.mdb")
ConnObj.Open "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
for i = 1 to request.form("itemcnt")
if request.form("Quantity" & i ) > "" and isnumeric(request.form("Quantity" & i )) and request("onhand" & i ) > "" and isnumeric(request("onhand" & i )) then
newqty = cint(request("Quantity" & i ))
onhand = cint(request("onhand" & i ))
if newqty > onhand then
newqty = onhand
end if
neworder = request.form("Order" & i)
CommandText = "UPDATE [Order] SET [Order].Quantity = " & newqty
if request("cost_bid"& i)>"" and isnumeric(request("cost_bid"& i)) then
CommandText=CommandText & ", Cost_Bid=" & request("cost_bid"& i)
if request("cost_bid"& i) >= request("cost"& i) then
CommandText=CommandText & ", status='Shopping' "
end if
end if
CommandText=CommandText & " WHERE (((Order.OrderID)= " & neworder & "))"
'response.write (CommandText)
ConnObj.Execute(CommandText)
end if
next
response.redirect("/cart.asp")
%>
My cart.asp code:
<% DBPath = "../database/invatec.mdb" %>
<!--#include virtual="/modules/checksession.asp"-->
<%
Response.Expires=0
%>
<%
' invconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.Mappath("../database/invatec.mdb")
invconn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
Set rsInvatec3 = Server.CreateObject ("ADODB.Recordset")
SQLstr3="Select * From [Order] Where (Status='Shopping' or Status='Bid') and BuyerID=" & Session("CustomerID") & " order by vendor"
rsInvatec3.Open SQLstr3, invconn, 0, 1
if not(rsInvatec3.EOF or rsInvatec3.BOF) then
TotalCost = 0
SubTotal = 0
cntr = 1
do while not rsInvatec3.EOF
SubTotal = (rsInvatec3("Cost") * rsInvatec3("Quantity"))
TotalCost = TotalCost + SubTotal
%>
My checksession.asp code:
<!-- #include virtual="/adovbs.inc" -->
<%
response.Expires=0
response.buffer = true
' check for session variables[done]
' if they exist then move on
if not Session("ID")>"" or request("Login") > "" then
if Request.Cookies("SavedLogin")("ID")>"" then ' was here before
UserID=Request.Cookies("SavedLogin")("ID")
Password=Request.Cookies("SavedLogin")("Pass")
end if
if request("Login") > "" then ' logged in from screen
UserID=request("Login")
Password=request("Password")
end if
if Session("regLogin") > "" and Session("regPassword") > "" then
UserID = Session("regLogin")
Password = Session("regPassword")
Session("regLogin") = ""
Session("regPassword") = ""
end if
if UserID > "" and Password > "" then
' Conn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath( DBPath )
Conn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
Set rsPassword = Server.CreateObject ("ADODB.Recordset")
SQLstr="Select * from Customers where Status='Active' and UserID='" & UserID & "' and Password='" & Password & "'"
' rsPassword.Open SQLstr, Conn, 3, 3
rsPassword.Open SQLstr, Conn, adOpenStatic, adLockReadOnly
if rsPassword.RecordCount > 0 then
' set session variables
Session("ID") = UserID
Session("Pass") = Password
Session("CompanyName") = rsPassword("Customer")
Session("CustomerID") = rsPassword("CustomerID")
Session("IDTMember") = rsPassword("IDTMember")
Session("UserLoggedIn") = true
' set cookies
Response.Cookies("SavedLogin")("ID") = UserID
Response.Cookies("SavedLogin")("Pass") = Password
Response.Cookies("SavedLogin").Expires = Date + 30
else
Session("Message") = "<br><img src='/img/transupply.gif' width='4' height='4' border='0'>Incorrect Login/Password"
response.redirect ("/register.asp")
end if
rsPassword.Close
set rsPassword = Nothing
else
Session("UserLoggedIn") = false
end if
end if
if Session("UserLoggedIn") = true then
' invconn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & server.mappath( DBPath )
invconn = "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=HIDA-TEST3;User ID=*****;Password=*****"
Set rsInvatec3 = Server.CreateObject ("ADODB.Recordset")
SQLstr3="Select * From [Order] Where (Status='Shopping' or Status='Bid') and BuyerID=" & Session("CustomerID") & " order by vendor"
rsInvatec3.Open SQLstr3, invconn, 0, 1
if not(rsInvatec3.EOF or rsInvatec3.BOF) then
Session("CartItems") = true
else
Session("CartItems") = false
end if
rsInvatec3.Close
set rsInvatec3 = Nothing
end if
%>