<%
strhttp=request.ServerVariables("script_name")
str=split(strhttp,"/")
n=ubound(str)
str1=str(n-1)
function myimg(imgurl)
img=Instr(1,Lcase(imgurl),"
![]()
0 then
'找到了图片标记
url=Instr(img,Lcase(imgurl),"src=")
if url<>0 then
'找到了图片地址
if mid(Lcase(imgurl),url+4,1)=chr(34) then
last=Instr(url+5,Lcase(imgurl),chr(34))
imgUrl=mid(Lcase(imgurl),url+5,last-url-4)
else
if mid(Lcase(imgurl),url+4,1)=chr(39) then
last=Instr(url+5,Lcase(imgurl),chr(39))
imgUrl=mid(Lcase(imgurl),url+5,last-url-4)
else
last=Instr(url+5,Lcase(imgurl)," ")
imgUrl=mid(Lcase(imgurl),url+5,last-url-4)
end if
end if
else
imgUrl=""
end if
else
imgUrl=""
end if
imgurl=replace(imgurl,chr(34),"")
myimg = imgUrl
end function
page=cint(request("page"))
msg_per_page=40
ConnStr = "driver={SQL Server};Server=(local);User ID=sa;Password=pan#ming526;Database=photos"
Set Conn = Server.CreateObject("Adodb.Connection")
Conn.Open ConnStr
NewsSql = "Select FS_News.fileextname,FS_News.path,FS_News.picpath,FS_News.filename,FS_News.title,FS_News.NewsID,FS_News.content,FS_Newsclass.classename from FS_News,FS_Newsclass where FS_News.classid=FS_Newsclass.classid and FS_Newsclass.classename='"&str1&"' and FS_News.picnewstf=1 order by FS_News.id desc "
set rs=server.CreateObject("adodb.recordset")
rs.pagesize = msg_per_page '定义分页记录集每页显示记录数
rs.open NewsSql,conn,1,1
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
totalrec = RS.RecordCount 'totalrec:总记录条数
if rs.recordcount mod msg_per_page = 0 then
n = rs.recordcount\msg_per_page 'n:总页数 '如果总页数/每页显示记录条数正好为整数
else
n = rs.recordcount\msg_per_page+1 '总页数/每页显示记录条数不为整数,表示有小于每页显示记录条数的数据出现,也应做为一页显示
end if
currentpage = request("page") 'currentpage:当前页
'以下防止在浏缆器中直接输入错误参数
If currentpage <> "" then
currentpage = cint(currentpage)'小数->整数
if currentpage < 1 then '小于1的数
currentpage = 1
end if
if err.number <> 0 then
err.clear
currentpage = 1
end if
else
currentpage = 1
End if
if currentpage*msg_per_page > totalrec and not((currentpage-1)*msg_per_page < totalrec)then '大于总页数
currentPage=1
end if
rs.absolutepage = currentpage '设置指针指向某页开头
rowcount = rs.pagesize '设置每一页的数据记录数
%>
<%
while not rs.eof and rowcount>0
%>
<%
rowcount=rowcount-1
rs.movenext
wend
end if
end if
%>