| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 650 人关注过本帖
标题:表格显示问题
只看楼主 加入收藏
ta8607
Rank: 4
等 级:业余侠客
帖 子:377
专家分:244
注 册:2007-9-22
结帖率:80%
收藏
 问题点数:0 回复次数:6 
表格显示问题

if action="" then%>
<form name=ddyx action=ddyx.asp method=post>
<table width="579" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#808080" bordercolor="#FFFFFF" bordercolordark="#FFFFFF" style="table-layout:fixed;word-break:break-all">
<tr>
<td align=center width=12%>顾客姓名</td>
<td align=center width=13%>顾客邮件</td>
<td align=center width=28%>顾客单位</td>
<td align=center width=11%>顾客电话</td>
<td align=center width=11%>顾客手机</td>
<td align=center width=13%>其他联系方式</td>
<td align=center width=12%>感兴趣产品</td>
</tr>
<%
dim rs,msg_per_page
dim sql
msg_per_page = 10 '每页显示记录数
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from dingdang"
rs.cursorlocation = 3
rs.pagesize = msg_per_page '每页显示记录数
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<tr><td colspan=6 align=center height=50>暂时没有留言</td></tr>"
end if
if not (rs.eof and rs.bof) then '检测记录集是否为空
totalrec = RS.RecordCount '总记录条数
if rs.recordcount mod msg_per_page = 0 then '计算总页数,recordcount:数据的总记录数
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
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 'absolutepage:设置指针指向某页开头
rowcount = rs.pagesize 'pagesize:设置每一页的数据记录数
dim i
dim k
Do while not rs.eof and rowcount>0
UserName=rs("UserName")
usermail=rs("usermail")
danwei=rs("dangwei")
dianhua=rs("dianhua")
shouji=rs("shouji")
qq=rs("qq")
changping=rs("changping")
Response.write "<tr><td align=center>"&UserName&""
Response.write "</td><td align=center>"&usermail&""
Response.write "</td><td align=center>"&dangwei&""
Response.write "</td><td align=center>"&dianhua&""
Response.write "</td><td align=center>"&shouji&""
Response.write "</td><td align=center>"&qq&""
Response.write "</td><td align=center>"&changping&""
Response.write "</td></tr>"
rowcount=rowcount-1
rs.movenext
loop
end if
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
</table>
</form>
显示结果如下:

图片附件: 游客没有浏览图片的权限,请 登录注册

当单元格内记录为空时,连表格线都没有看到,大家知道为什么会出现这种情况吗?
谢谢!!!!

搜索更多相关主题的帖子: 表格 align 顾客 center 
2007-11-20 08:54
linyesu
Rank: 1
等 级:新手上路
帖 子:77
专家分:0
注 册:2007-9-17
收藏
得分:0 
修成这样 Response.write "<tr><td align=center>"&UserName&"</td>"
     Response.write............同理
2007-11-20 09:09
ta8607
Rank: 4
等 级:业余侠客
帖 子:377
专家分:244
注 册:2007-9-22
收藏
得分:0 
不行啊.还是这样显示.有别的办法吗?谢谢!!

不理会流言蜚语,努力做好份内事情,只做自己.
2007-11-20 09:44
永夜的极光
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:2721
专家分:1
注 册:2007-10-9
收藏
得分:0 
if isnull(rs("UserName")) or rs("UserName")="" then
username="&nbsp;"
else
UserName=rs("UserName")
end if

如果为空的话,加个空格就可以了

从BFS(Breadth First Study)到DFS(Depth First Study)
2007-11-20 10:02
ta8607
Rank: 4
等 级:业余侠客
帖 子:377
专家分:244
注 册:2007-9-22
收藏
得分:0 
用版主的方法解决了~~~
谢谢两位!!!!

不理会流言蜚语,努力做好份内事情,只做自己.
2007-11-20 11:09
craft001wen
Rank: 2
等 级:论坛游民
帖 子:242
专家分:62
注 册:2006-5-4
收藏
得分:0 
还有一个更简单的办法:
Response.write "<tr><td align=center>&nbsp;"&UserName&"</td>"
就是,不用判断直接加一个空格,管它有没有数据,加一个空格也不影响

2007-11-20 14:08
ta8607
Rank: 4
等 级:业余侠客
帖 子:377
专家分:244
注 册:2007-9-22
收藏
得分:0 
嗯,这方法好,谢谢你!!

不理会流言蜚语,努力做好份内事情,只做自己.
2007-11-21 16:02
快速回复:表格显示问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022292 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved