100个表格的问题!在线等待!~!!

lixu13898072020 2006-01-13 10:20:35
一个页面,上面显示10*10 100个格子,每个格子的数据是从数据库读出来的,

如果表有10条记录,见显示在前10个格子里,其余90个显示默认的文字,如果没有记录 100个格子都显示默认的文字,如果>100条记录,就显示分页!

那个高手可以给我解决一下,在线等待!~!!
...全文
208 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
wellan 2006-01-16
  • 打赏
  • 举报
回复
没去做这个东西,但是如果你要实现的话,应该按这个思路:

1.首先100个分页
2.条件判断,是执行分页还是执行其它
lonaerd 2006-01-15
  • 打赏
  • 举报
回复
先写好每页按100条记录分页程序吧,参照一下网上例子。
lixu13898072020 2006-01-14
  • 打赏
  • 举报
回复
Hiyeah2001(晨风) 大哥 有好多错误呢!

Microsoft VBScript 编译器错误 错误 '800a03f6'
缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft VBScript 运行时错误 错误 '800a000d'

类型不匹配: 'showpages'

/index.asp,行76

Hiyeah2001 2006-01-14
  • 打赏
  • 举报
回复
郁闷!谁说它困难了。
出了错误总要纠正一下吧。
伤了!!!!
竹林听雨2005 2006-01-14
  • 打赏
  • 举报
回复
厉害,写了一堆代码上来了,呵。

其实跟JSPADMIN所说的一样,不是很困难,
Hiyeah2001 2006-01-14
  • 打赏
  • 举报
回复
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
实在抱歉!!!!!!!写的比较匆忙。
wungshly 2006-01-14
  • 打赏
  • 举报
回复
up
lixu13898072020 2006-01-14
  • 打赏
  • 举报
回复
还有 上面的错误我屏蔽了,还有就是

我现在数据库有一个记录,为 78,您现在写的代码结果是显示 100个 78 我要求是显示一个78 和99个默认值
Hiyeah2001 2006-01-13
  • 打赏
  • 举报
回复
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
时间关系没运行,有错误的话你自己改一下!

jspadmin 2006-01-13
  • 打赏
  • 举报
回复
具体涉及两个方面:格式控制和分页,没什么技术难度。分页弄好了,就没问题
zhanghongwen 2006-01-13
  • 打赏
  • 举报
回复
UP
zkxp 2006-01-13
  • 打赏
  • 举报
回复
哦,你要做网络格子啊.觉得还是生成文件比较科学点.
你这个问题是横向循环记录问题.你显示的很多,需要很多判断.超过100次.
根据你的情况帮你写了下.自己修改下就可以用了.可以用include方法包含也可以生成JS文件来调用.

<%
'...open database and creat rs

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
%>
hansonboy 2006-01-13
  • 打赏
  • 举报
回复
没有什么难度,一般的数据显示试试就可以了, 不过是多了个固定表格
ybfqlyq 2006-01-13
  • 打赏
  • 举报
回复
Hiyeah2001(晨风) ( ) 信誉:100 這個就可以了。。
像普通的那樣從數據庫讀取數據就行了,分頁也沒什麼難的。
尚和空四 2006-01-13
  • 打赏
  • 举报
回复
还是自己做了。呵呵

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧