|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
[ASP]合并表数据效率低还是程序问题?
现在我把论坛的主帖表与回复表合并,按如下方式写的程序
[code]
conn '连接数据库
Set rstem=Server.CreateObject("ADODB.RecordSet")
rstem.Open "select * from reply",conn,1,1
do while not rstem.EOF
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open "news",conn,adopendynamic,3
rs.addnew
rs("content")=rstem("rinfo")
rs("name")=rstem("ruser")
rs("num")=rstem("pid")
rs("day")=rstem("day")
rs.update
rs.close
set rs=nothing
response.write"数据己收入数据库中<br>"
%>
<% rstem.MoveNext
loop
response.write "全部完成"
rstem.close
set rstem=nothing
conn.close
set conn=nothing
%>
[/code]
执行时,从状态栏看是正在打开,进度缓慢。没提示完成,也没提示出错。。我查看了回复列表,也就60多条记录。
请问程序有没有很大问题?现在测试验ing......... |
先rs
再rstem
晕。 |
版主,我刚发帖就看到了,现在改过来了,一试果然成功完成。谢谢!! |
晕,曲解版主的意思了,我开始写错了,将RSTEM写成RS了。
[code]
conn '连接数据库
%>
<%
set rs=server.createobject("adodb.recordset")
rs.open "news",conn,adopendynamic,3
Set rstem=Server.CreateObject("ADODB.RecordSet")
rstem.Open "select * from reply",conn,1,1
do while not rstem.EOF
rs.addnew
rs("content")=rstem("rinfo")
rs("name")=rstem("ruser")
rs("num")=rstem("pid")
rs("day")=rstem("day")
rs.update
rstem.MoveNext
loop
rstem.close
set rstem=nothing
rs.close
set rs=nothing
response.write"数据己收入数据库中<br>"
%>
[/code]
确实这样效率会高很多。 |
|