ASP 相加后,循环输出
比如图中“1”中字数才2个,需要加下面的字段超过10个,最后"2"字段显示
10BBAAAAAAAA
11AABBBBBBBB
.................
do while not rs.eof
if len(rs("1"))<10 then
end if
rs.movenext
loop
------解决方案--------------------<%
....
set rs = server.CreateObject("adodb.recordset")
sql = "select * from table"
rs.open sql, conn, 1, 3
do while not rs.eof
str=rs("1")
while (len(str)<10 and not rs.eof)
str=str&rs("1")
rs.movenext
wend
rs("2")=str
rs.update
if not rs.eof then
rs.movenext
end if
loop
...
%>
------解决方案--------------------s=""
do while not rs.eof
s = s & rs("1")
if len(rs("1"))=10 then
rs("2") = s
s = ""
rs.update
end if
rs.movenext
loop