将ASP纪录集输出成n列的表格形式显示的方法

<iframe name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-4490194096475053&amp;dt=1225678076031&amp;lmt=1219829520&amp;prev_slotnames=1891601125&amp;output=html&amp;slotname=3685991503&amp;correlator=1225678075937&amp;url=http%3A%2F%2Fwww.corange.cn%2Farchives%2F2008%2F08%2F1434.html&amp;ea=0&amp;ref=http%3A%2F%2Fwww.corange.cn%2Fhtml%2Fcorange__71.html&amp;frm=0&amp;ga_vid=794657364.1225360561&amp;ga_sid=1225676616&amp;ga_hid=939561934&amp;ga_fc=true&amp;flash=9.0.124.0&amp;u_h=768&amp;u_w=1024&amp;u_ah=715&amp;u_aw=1024&amp;u_cd=32&amp;u_tz=480&amp;u_java=true" frameborder="0" width="300" scrolling="no" height="250" allowtransparency></iframe>
'定义变量
Dimcn,rs,Sql

Sql="selectCustomerIDfromOrders"

'记录总数
DimTotalNumbe
Setcn=Server.CreateObject("ADODB.Connection")
cn.Open"Provider=SQLOLEDB.1;UserID=sa;InitialCatalog=NorthWind;DataSource=.;Password=;"

Setrs=Server.CreateObject("ADODB.Recordset")
rs.OpenSql,cn,3,1
TotalNumber=rs.RecordCount
IfTotalNumber=0Then
Response.Write"没有记录输出。"
Else
Dimjj,nLeft,cCol
jj=0
nCol=415
nLeft=nCol-(TotalNumberModnCol)
IfnLeft=nColThennLeft=0
Response.Write"<tableborder><tr>"&vbCrLf
Whilenotrs.EOF
Response.Write"<td>"&rs("CustomerID")&"</td>"&vbCrLf
'If(jjModnCol)=(nCol-1)Andjj<>TotalNumber-1ThenResponse.Write"</tr><tr>"&vbCrLf
'If(jjModnCol)=(nCol-1)Andjj=TotalNumber-1ThenResponse.Write"</tr>"&vbCrLf

If(jjModnCol)=(nCol-1)Then
Ifjj<>TotalNumber-1Then
Response.Write"</tr><tr>"&vbCrLf
Else
Response.Write"</tr>"&vbCrLf
EndIf
EndIf
jj=jj+1
rs.MoveNext
Wend
IfnLeft<>0AndnLeft<>nColThen
IfnCol<TotalNumberThen
Fori=1tonLeft
Response.Write"<td>&nbsp;</td>"&vbCrLf
Next
EndIf
Response.Write"</tr>"&vbCrLf
EndIf
Response.Write"</table>"
EndIf
rs.Close
Setrs=Nothing
cn.Close
Setcn=Nothing
Response.End
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值