读书人

access能导入20万数据吗?该如何解决

发布时间: 2012-04-04 16:38:51 作者: rapoo

access能导入20万数据吗?

HTML 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><!--#include file="conn.asp"--></head><body> <% set link=server.CreateObject("adodb.recordset")link.open "select  * from numkey ",conn,1,1if link.eof and link.bof thenresponse.Write(" 暂无记录 !")end ifwhile not link.eofp = link("useradmin")m = link("userpassword")d = 1Set rs=conn.execute("select top 1 id from [user] where useradmin='"&p&"'")if rs.eof then    conn.execute("insert into [user](useradmin,userpassword,dailiid) values('"&p&"','"&m&"','"&d&"')")end if    link.movenextwendlink.closeset link=nothing%></body></html>

numkey表 和user表结构完全一样,numkey表有20万行数据,我想把numkey表中的useradmin,userpassword字段值复制到user表中,上面就是我写的程序,但是执行的话很慢,容易假死,只能插入10来万数据,后来越来越慢。请问高手有什么好方法,我的代码是不是写得有问题?

[解决办法]
你每次都 select top 1 id from,这步操作是否可以不做的?

另外,你在 useradmin 这个字段上做了索引么?如果没做就相当于每次都要全表扫描的。

读书人网 >ASP

热点推荐