%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("../database/#w163.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
if err then
err.clear
else
conn.open connstr
if err then
err.clear
end if
end if
%>
<% if session("admin")="" then
response.Write ""
response.End
end if
dim rs100,k
set rs100=server.CreateObject("adodb.recordset")
if request("bookid")=0 then
sql="select * from w163_books order by adddate desc"
else
sql="select * from w163_books where bookid="&request("bookid")&" order by adddate desc"
end if
response.write sql
rs100.open sql,conn,3,3
j=1
do while not rs100.eof
dim bookid
bookid=rs100("bookid")
dim wcn2
wcn2=wcn2 &"
"
wcn2=wcn2 & " "
wcn2=wcn2 &"| 推荐商品 | "
wcn2=wcn2 & "
"
sql="select * from w163_books where bookid="&bookid&"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
set rs3=server.CreateObject("adodb.recordset")
rs3.open "select top 4 * from w163_books where nclassid="&rs("nclassid")&" order by liulancount desc",conn,1,1
if rs3.eof and rs3.bof then
wcn2=wcn2 & " | 暂无此类商品 |
"
else
wcn2=wcn2 &""
wcn2=wcn2 &""
j=0
do while not rs3.eof
wcn2=wcn2 &""
wcn2=wcn2 &""
wcn2=wcn2 &""
wcn2=wcn2 &" | "
wcn2=wcn2&" | "
rs3.movenext
j=j+1
if rs3.eof then
exit do
end if
if j>=4 then exit do
loop
wcn2=wcn2&"
"
rs3.close
set rs= nothing
set rs3= nothing
wcn2=wcn2&"
"
end if
wcn2=wcn2&""
wcn2=wcn2&""
wcn2=wcn2&""
wcn2=wcn2&""
wcn2=wcn2&""
wcn2=wcn2&"
"
dim rs_8,sql_8,okfile
set rs_8 = server.CreateObject ("Adodb.recordset")
sql_8="select * from demo where ifuse=1 and demoid="&request("demoid")
rs_8.open sql_8,conn,1,1
okfile=rs_8("demohtml")
rs_8.close
okfile = replace(okfile,"wcn2",wcn2)
fpath="..\vip1"
fname="w163"&bookid&".htm"
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.Createtextfile(server.mappath(fpath&"\"&fname),true)
fout.writeline okfile
fout.close
rs100.movenext
k=k+1
if k>=50000 then exit do
loop
rs100.close
set rs100=nothing
response.write "ok"
%>