蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 应用编程


    

蓝森林 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]

确实这样效率会高很多。




Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com