请教关于非常规性表格显示数据的处理办法?

yinxun 2014-03-12 04:08:37
asp+access

假设数据库里有如下数据:
ID chicun weizhi fangjian
1 42寸 电视墙左上 101室
2 32寸 电视墙左下 101室
3 42寸 电视墙右上 101室
4 32寸 电视墙右下 101室
5 42寸 电视墙左上 102室
6 32寸 电视墙左下 102室
7 42寸 电视墙右上 102室
8 32寸 电视墙右下 102室
9 42寸 电视墙中上 102室
10 32寸 电视墙中下 102室
……


如果说在asp页面上做个表格把上述数据显示出来,太简单不过了(就按下面的代码就可以了,这个我会)
但我现在的需求是,用“实景”方式把上述数据显示出来
比如101室4台电视机的排列是“田”字形,102室是6个口字型



当然,每个房间的形状不一样,表格我只能写死,不可能用循环语句写出来

但是每个单元格里要显示不同的数据(可以根据ID写死,比如101房间的左上,我就定义为ID为1的那行数据中的“尺寸”,把这个值写到单元格里去,然后提供一个编辑功能,供以后有调整可以修改)

请问这样的怎么写啊,SQL和页面语句怎么弄?请大神指点,最好能帮我把下述代码改改,求教


<!--#include file="inc_common_sql.asp"-->
<!--#include file="UBB.asp"-->
<%

dim currentpage,page_count,Pcount
dim totalrec,endpage
if Request.QueryString("page")="" then
currentPage=1
else
currentPage=cint(Request.QueryString("page"))
end if

if login then
pagename="管理信息"
else
pagename="查看信息"
end if



call bodySkin()
sub pageContent()
showMsg()
end sub

function showMsg()


sql="select * from tv"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1


if rs.eof and rs.bof then
rs.close
set rs=nothing
errinfo="<li>还没有任何记录。</li>"
call showError()
end if

rs.pagesize = perpage
rs.absolutepage=currentpage
page_count=0
totalrec=rs.recordcount

if not totalrec mod perpage=0 then
if currentPage > (totalrec/perpage)+1 then response.redirect "?page=" & Int((totalrec/perpage))+1
else
if currentPage > (totalrec/perpage) then response.redirect "?page=" & Int((totalrec/perpage))
end if


Response.write("<table border=1 width='97%' cellspacing=1 align=center cellpadding=3 bordercolor=#ad8c42 style=BORDER-COLLAPSE: collapse;><tr><td align=center width='25%'><b>序号</b></td><td align=center width='25%'><b>尺寸</b></td><td align=center width='25%'><b>位置</b></td><td align=center width='25%'><b>房间</b></td></tr>")



while (not rs.eof) and (not page_count = rs.pagesize)

dim x_xuhao,x_chicun,x_weizhi,x_fangjian

x_xuhao =rs("id")
x_chicun =rs("chicun")
x_weizhi = rs("weizhi")
x_fangjian = rs("fangjian")


%>




<a id="msg<%=rs("id")%>">



<tr class="title2" align="center">
<td>
<% response.write x_xuhao %>
</td>
<td>
<% response.write X_chicun %>
</td>
<td>
<% response.write X_weizhi %>
</td>
<td>
<% response.write X_fangjian %>
</td>
</tr>


<%
page_count = page_count + 1
rs.movenext
wend
%>
</table>

<%
rs.close
set rs=nothing
end function
%>
...全文
111 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
yinxun 2014-03-12
  • 打赏
  • 举报
回复
不好意思 号被朋友开玩笑了 请大神解答~
yinxun 2014-03-12
  • 打赏
  • 举报
回复
ni shi ge shabia

28,409

社区成员

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

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