首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

关于id号排列顺序的有关问题,来看看

2012-02-16 
关于id号排列顺序的问题,来看看!数据表中有10条数据,id号是自动增长的,1、2、3、4、5、6、7、8、9、10,现在我需要分

关于id号排列顺序的问题,来看看!
数据表中有10条数据,id号是自动增长的,1、2、3、4、5、6、7、8、9、10,现在我需要分成两列来显示,也是按照顺序,第一列 1、2、3、4、5 第二列 6、7、8、9、10 而现在我做出来的两列变成 1、3、5、7、9 第二列为:2、4、6、8、10 了,有什么办法每列按照顺序来显示。

[解决办法]
这样写

VBScript code
Response.Write "<table style='width:100%;'>"Response.Write vbCrLfWhile Not rs.EOF  Response.Write "<tr>"  Response.Write vbCrLf      For m = 1 To 5    If rs.EOF Then        Response.Write "<td>&nbsp;</td>"    Else      Response.Write "<td>" & rs("id") & "</td>"              rs.MoveNext    End If    Response.Write vbCrLf        Next        Response.Write "</tr>"    Response.Write vbCrLfWendResponse.Write "</table>"
[解决办法]
原理就是这样了,把数据库操作的加进去就行了,把iii =iii+1 这样的改成指针向下移
VBScript code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title></head><%X = 10  '定义行数Y = 5   '定义列数iii = 1%><body><table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">  <tr>  <%for i=1 to Y%>    <td align="center"><table width="98%" border="1" cellpadding="2" cellspacing="1">         <%for j=1 to x%>        <tr>          <td height="19" align="center"><%response.write("ID: " & iii)iii = iii + 1%></td></tr><%Next%>      </table></td><%Next%>   </tr></table></body></html> 

热点排行