主题:  购物车在原地打转。

vietnam

职务:普通成员
等级:1
金币:0.0
发贴:43
注册:2002/10/19 2:25:01
#12002/10/19 2:42:19
前面的什么都搞好了。就是最后的一步Save cart to table的命令时,数据老是提交不上数据库。(在原地打转,数据库也没东西。)Save cart to table命令有“!”

源代码(代码说明-----有个会员验证的行为、价格数据分三种,复杂了点。):
----------------------------------------------------------------------------------------------------------------------------
<%@LANGUAGE="VBSCRIPT"%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers=""
MM_authFailedURL="shopadmin.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<%
UC_OrderIdSessionVar = "OrderID"
If Session(UC_OrderIdSessionVar)="" Then
' Get a unique OrderID number and save to session.
UC_tableName = "ord_id"
UC_fieldName = "orid"
UC_sql = "select " & UC_fieldName & " from " & UC_tableName
tmp = "ADODB.Recordset"
set UC_rsId = Server.CreateObject(tmp)
UC_rsId.ActiveConnection = "Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\webhosting\clients\popo\database\shop.mdb;Uid=;Pwd=;"
UC_rsId.Source = UC_sql
UC_rsId.CursorType = 0    ' adOpenForwardOnly
UC_rsId.CursorLocation = 2 ' adUseServer
UC_rsId.LockType = 2 ' adLockPessimistic
UC_rsId.Open
Session(UC_OrderIdSessionVar) = UC_rsId.Fields(UC_fieldName).value
UC_rsId.Fields(UC_fieldName).value = Session(UC_OrderIdSessionVar) + 1
UC_rsId.Update
UC_rsId.Close
set UC_rsId = Nothing
End If
%>




<%
UC_CartColNames=Array("ProductID","Quantity","Name","toprice2","toprice1","price2","price1","Price","toweight","weight","pack","Total")
UC_ComputedCols=Array("","","","price2","price1","","","","weight","","","Price")
set UCCart1=VBConstuctCart("abCart",1,UC_CartColNames,UC_ComputedCols)
UCCart1__i=0
%>
<%
Dim rshy__MMColParam
rshy__MMColParam = "1"
if (Session("MM_Username") <> "") then rshy__MMColParam = Session("MM_Username")
%>
<%
set rshy = Server.CreateObject("ADODB.Recordset")
rshy.ActiveConnection = MM_shop_STRING
rshy.Source = "SELECT cu_id, email, cu_name, dh, fax, zip, dz, fhdz FROM cuhy WHERE email = '" + Replace(rshy__MMColParam, "'", "''") + "'"
rshy.CursorType = 0
rshy.CursorLocation = 2
rshy.LockType = 3
rshy.Open()
rshy_numRows = 0
%>
<%
UC_updateAction = CStr(Request("URL"))
If (Request.QueryString <> "") Then
UC_updateAction = UC_updateAction & "?" & Request.QueryString
End If
If (Request.Form("textfield").Count > 0) Then
UCCart1.Update("textfield")
If ("" <> "") Then
Response.Redirect("")
End If
End If
%>
<%
If InStr(1, MM_editAction, "?", vbTextCompare) = 0 Then
MM_editAction = MM_editAction + "?UC_SaveCartToTable=1"
Else
MM_editAction = MM_editAction + "&UC_SaveCartToTable=1"
End If
If (CStr(Request("UC_SaveCartToTable")) = "1") Then
set UC_connCart = Server.CreateObject("ADODB.Connection")
UC_connCart.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=d:\webhosting\clients\popo\database\shop.mdb;Uid=;Pwd=;"
UC_redirectPage = "gwok.asp"
UC_destColName = Array("productid","quantity","","","","","","","totalweight","","pack","totalprice")
UC_destColType = Array("num","num","str","str","str","str","str","str","num","num","str","str")
UC_orderId = OrderID
UCCart1.SaveToDatabase UC_connCart,"sell","orid","num",UC_orderId,UC_destColName,UC_destColType
' redirect with URL parameters (remove the "UC_SaveCartToTable" query param).
if (UC_redirectPage = "") Then UC_redirectPage = CStr(Request.ServerVariables("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
newQS = "?"
For Each Item In Request.QueryString
If (Item <> "UC_SaveCartToTable") Then
If (Len(newQS) > 1) Then newQS = newQS & "&"
newQS = newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(newQS) > 1) Then UC_redirectPage = UC_redirectPage & newQS
End If
Response.Redirect(UC_redirectPage)
End If
%>
<%
UC_EmptyCart = CStr(Request.ServerVariables("URL")) & "?UC_EmptyCart=1"
If (CStr(Request("UC_EmptyCart")) = "1") Then
UCCart1.Destroy()
UC_redirectPage = ""
' redirect with URL parameters (remove the "UC_EmptyCart" query param).
if (UC_redirectPage = "") Then UC_redirectPage = CStr(Request.ServerVariables("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
newQS = "?"
For Each Item In Request.QueryString
If (Item <> "UC_EmptyCart") Then
If (Len(newQS) > 1) Then newQS = newQS & "&"
newQS = newQS & Item & "=" & Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(newQS) > 1) Then UC_redirectPage = UC_redirectPage & newQS
End If
Response.Redirect(UC_redirectPage)
End If
%>


购物车


















































<%=(rshy.Fields.Item("cu_name").value)%>您好!谢谢您购买本商城的商品。


您这次订购的商品我们将按您提供的地址送到[<%=(rshy.Fields.Item("fhdz").value)%>],如果您对此地址有疑问,请按此修改


您的电话是:<%=(rshy.Fields.Item("dh").value)%>,传真:<%=(rshy.Fields.Item("fax").value)%>,邮编:<%=(rshy.Fields.Item("zip").value)%>。


 













<% For UCCart1__i=0 To UCCart1.GetItemCount()-1 %>









<% Next 'UCCart1__i %>









编号 商品名 单价(标准/会员/高级) 数量 重量(单个/总重) 包装说明 小计(标准/会员/高级)
<%=(UCCart1.GetColumnvalue("ProductID",UCCart1__i))%> <%=(UCCart1.GetColumnvalue("Name",UCCart1__i))%> <%=(UCCart1.GetColumnvalue("Price",UCCart1__i))%>元/<%=(UCCart1.GetColumnvalue("price1",UCCart1__i))%>元/<%=(UCCart1.GetColumnvalue("price2",UCCart1__i))%>元
">
<%=(UCCart1.GetColumnvalue("weight",UCCart1__i))%>克/<%=(UCCart1.GetColumnvalue("toweight",UCCart1__i))%>克 <%=(UCCart1.GetColumnvalue("pack",UCCart1__i))%> <%=(UCCart1.GetColumnvalue("Total",UCCart1__i))%>元/<%=(UCCart1.GetColumnvalue("toprice1",UCCart1__i))%>元/<%=(UCCart1.GetColumnvalue("toprice2",UCCart1__i))%>元






 








<%
rshy.Close()
%>

编辑历史:[这消息被vietnam编辑过(编辑时间2002-10-21 19:43:00)]


54aft

职务:普通成员
等级:2
金币:1.0
发贴:657
注册:2002/8/26 17:11:53
#22002/10/21 19:37:08
为何无人应答