if request("add")="yes" and request("cpid")"" then
if request("cpid")="" or isNumeric(Request("cpid"))=False then
Response.Write("alert(""商品编号错误!"");history.back();")
response.end
end if
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Merchandise where id="&request("cpid")&""
rs.open sql,conn,0,1
if (rs.eof and rs.bof) then
Response.Write("alert(""没有此商品!"");history.back();")
response.end
rs.close
end if
Set rs1 = Server.CreateObject("ADODB.Recordset")
sql="select * from Commend where BigId="&request("BigId")&""
rs1.open sql,conn,1,1
if rs1.RecordCount conn.execute("Insert into Commend(cpid,TradeName,SmallPic,BigId)values("&request("cpid")&",'"&rs("TradeName")&"','"&rs("SmallPic")&"',"&request("BigId")&")")
elseif rs1.RecordCount conn.execute("Insert into Commend(cpid,TradeName,SmallPic,BigId)values("&request("cpid")&",'"&rs("TradeName")&"','"&rs("SmallPic")&"',"&request("BigId")&")")
else
Set rs2 = Server.CreateObject("ADODB.Recordset")
sql="select * from Commend where BigId="&request("BigId")&" order by Date"
rs2.open sql,conn,0,1
id=rs2("id")
rs2.close
conn.execute("Update Commend set cpid="&request("cpid")&",TradeName='"&rs("TradeName")&"',SmallPic='"&rs("SmallPic")&"',BigId="&request("BigId")&",[Date]='"&now()&"' where id="&id&"")
end if
rs1.close
end if
if request("del")="yes" then
conn.execute("Delete From Commend where id="&request("id")&"")
Response.redirect "Commend.asp?page="&request("page")&""
end if
%>
推荐商品
商品ID
商品名称
位 置
删 除
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from Commend order by Date desc"
rs.open sql,conn,1,1
if rs.eof then
Response.Write"暂无记录,请及时添加!"
'response.end
end if
rs.pagesize=15
if request("page")="" or isNumeric(request("page"))=false then
page = 1
else
page=int(request("page"))
end if
if page>rs.pagecount then
page=rs.pagecount
end if
if not rs.BOF then
rs.Move rs.PageSize*(page-1)
end if
i=1
do while not rs.eof and i %>
if rs("BigId")="0" then
Response.Write("首页")
else
Set rs1 = Server.CreateObject("ADODB.Recordset")
sql="select BCName from BigClass where BigId="&rs("BigId")&""
rs1.open sql,conn,0,1
Response.Write(""&rs1("BCName")&"")
rs1.close
end if%>
i=i+1
rs.MoveNext
loop%>
if page-1 mod 10=0 then
p=(page-1) \ 10
else
p=(page-1) \ 10
end if
response.write "页次:"& page &"/"& rs.pagecount &"页 每页"& rs.pagesize &" 共"& rs.recordcount &"条记录"&_
" 分页:"
if p*10>0 then response.write "[<<] "
uming_i=1
for ii=p*10+1 to P*10+10
if ii=page then
response.write "["+Cstr(ii)+"] "
else
response.write "["+Cstr(ii)+"] "
end if
if ii=rs.pagecount then exit for
uming_i=uming_i+1
next
if ii response.write(" 跳页: ")
end if
rs.close%>
商品ID:
显示页面:
首页
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from BigClass order by BigId"
rs.open sql,conn,0,1
do while not rs.eof%>
loop
rs.close%>
注:每个页面最多能推荐5-6个商品。