dreamweaver编写购物车的问题(ASP)
我用数据库创建了一个购物车表每个用户有自己的购物车目前想要达到的效果是如果用户添加的书本的bookid不存在表中则将其插入反之则直接在表中修改对应bookid的书本的数量...
我用数据库创建了一个购物车表 每个用户有自己的购物车 目前想要达到的效果是 如果用户添加的书本的bookid不存在表中 则将其插入 反之则直接在表中修改对应bookid的书本的数量
目前代码如下 一段是修改 另一端为插入 求教该如何修改以达到目标的效果?
<%
if (String(Request("MM_update")) == "form1") {
if (!MM_abortEdit) {
// execute the update
var MM_editCmd = Server.CreateObject ("ADODB.Command");
MM_editCmd.ActiveConnection = MM_conBookshop_STRING;
MM_editCmd.CommandText = "UPDATE dbo.Trolley SET [Number] = [Number]+?, Mail = ?, BookId = ? WHERE BookId = ?";
MM_editCmd.Prepared = true;
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 5, 1, -1, (String(Request.Form("numberset")) != "undefined" && String(Request.Form("numberset")) != "") ? Request.Form("numberset") : null)); // adDouble
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 201, 1, 30, Request.Form("mail"))); // adLongVarChar
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3", 5, 1, -1, (String(Request.Form("BookId")) != "undefined" && String(Request.Form("BookId")) != "") ? Request.Form("BookId") : null)); // adDouble
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4", 5, 1, -1, (String(Request.Form("MM_recordId")) != "undefined" && String(Request.Form("MM_recordId")) != "") ? Request.Form("MM_recordId") : null)); // adDouble
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
}
}
%>
<%
if (String(Request("MM_insert")) == "form1") {
if (!MM_abortEdit) {
// execute the insert
超出字数限制 略去。。
}
}
%> 展开
目前代码如下 一段是修改 另一端为插入 求教该如何修改以达到目标的效果?
<%
if (String(Request("MM_update")) == "form1") {
if (!MM_abortEdit) {
// execute the update
var MM_editCmd = Server.CreateObject ("ADODB.Command");
MM_editCmd.ActiveConnection = MM_conBookshop_STRING;
MM_editCmd.CommandText = "UPDATE dbo.Trolley SET [Number] = [Number]+?, Mail = ?, BookId = ? WHERE BookId = ?";
MM_editCmd.Prepared = true;
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param1", 5, 1, -1, (String(Request.Form("numberset")) != "undefined" && String(Request.Form("numberset")) != "") ? Request.Form("numberset") : null)); // adDouble
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param2", 201, 1, 30, Request.Form("mail"))); // adLongVarChar
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param3", 5, 1, -1, (String(Request.Form("BookId")) != "undefined" && String(Request.Form("BookId")) != "") ? Request.Form("BookId") : null)); // adDouble
MM_editCmd.Parameters.Append(MM_editCmd.CreateParameter("param4", 5, 1, -1, (String(Request.Form("MM_recordId")) != "undefined" && String(Request.Form("MM_recordId")) != "") ? Request.Form("MM_recordId") : null)); // adDouble
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();
}
}
%>
<%
if (String(Request("MM_insert")) == "form1") {
if (!MM_abortEdit) {
// execute the insert
超出字数限制 略去。。
}
}
%> 展开
展开全部
set RsList = server.CreateObject("adodb.recordset")
SqlList = "SELECT * FROM ["&Datatable&"] where Product_Id =bookid"
RsList.open SqlList, objConn, 1, 3
if not RsList.eof ant not RsList.bof then
response.write("在表中!")
RsList.("ddd")=ddd
else
RsList.addnew
response.write("不在表中!")
RsList.("ddd")=ddd
end if
RsList.close
SqlList = "SELECT * FROM ["&Datatable&"] where Product_Id =bookid"
RsList.open SqlList, objConn, 1, 3
if not RsList.eof ant not RsList.bof then
response.write("在表中!")
RsList.("ddd")=ddd
else
RsList.addnew
response.write("不在表中!")
RsList.("ddd")=ddd
end if
RsList.close
深圳神光
2024-10-28 广告
2024-10-28 广告
初学者选择跨境电商选品软件时,应优先考虑软件的数据分析能力、市场趋势预测功能、产品数据库丰富度及更新速度。同时,易用性、用户评价及是否提供新手指导也是关键。此外,成本效益分析不可忽视,选择性价比高的软件更利于初期发展。建议试用几款主流软件,...
点击进入详情页
本回答由深圳神光提供
2013-06-06
展开全部
网上购网车代码多了去了自己下载个能用的把。定义都不清楚。,代码很混。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询