showcontent改为:
sub showContent
response.write "<table>"
for i=1 to 10
response.write "<tr>"
for j=1 to 10
response.write "<td>"
if not rs.eof then
if not (isnull(rs("riqi")) and isempty(rs("riqi"))) then
response.write rs("riqi")
else
response.write "默认值"
end if
rs.movenext
else
response.write "默认值"
end if
response.write "</td>"
next
response.write "</tr>"
next
response.write "</table>"
end sub
另加showpages为:
sub showpages()
dim n
if (totalPut mod MaxPerPage)=0 then
n= totalPut \ MaxPerPage
else
n= totalPut \ MaxPerPage + 1
end if
if n=1 then
response.write "<p align='left'>分页 "
response.write "[<b>1</b>] "
response.write "</p>"
exit sub
end if
dim k
response.write "<p align='left'>分页 "
for k=1 to n
if k=currentPage then
response.write "[<b>"+Cstr(k)+"</b>] "
else
response.write "[<b>"+"<a href=本页名?page="+cstr(k)+"'>"+Cstr(k)+"</a></b>] "
end if
next
response.write "</p>"
end sub
实在抱歉!!!!!!!写的比较匆忙。
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
数据库连接。。。。。。
if rs.eof and rs.bof then
response.write "<p><a href=add1.asp>添加信息</a></p>"
response.write "<p align='center'> 还 没 有 任 何 信 息</p>"
response.write "<p><a href=add1.asp>添加信息</a></p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showpages
showContent
showpages
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpages
showContent
showpages
else
currentPage=1
showpages
showContent
showpages
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
response.write "<table>"
for i=1 to 10
response.write "<tr>"
for j=1 to 10
response.write "<td>"
if isnull(rs("字段名")) or isempty(rs("字段名")) then
response.write "默认值"
else
response.write rs("字段名")
end if
response.write "</td>"
next
response.write "</tr>"
next
response.write "</table>"
end sub
时间关系没运行,有错误的话你自己改一下!
Dim DefaultContent = "你的格子"
Dim i, j
c = c &"<table>"& vbcrlf
For i=0 To 9
c = c &"<tr>"& vbcrlf
For j=0 To 9
If rs.eof Then
c = c &"<td>"& DefaultContent &"</td>"& vbcrlf
Else
c = c &"<td><a href='"& rs("Url") &"'><img src='"& rs("Img") &"'><a></td>"& vbcrlf
End If
c = c &"</tr>"& vbcrlf
Next
c = c &"</table>"& vbcrlf
Next
FSOWriteFile(c ,"part1.asp")
Sub FSOWriteFile(Content,LocalFilePath)
Dim ObjFile,FilePionter
Set ObjFile=Server.CreateObject("Scripting.FileSystemObject")
Set FilePionter = ObjFile.CreateTextFile(Server.MapPath(LocalFilePath),True)
FilePionter.Write Content
FilePionter.close
Set FilePionter = Nothing
Set ObjFile = Nothing
End Sub
%>