日期:2014-05-17  浏览次数:20959 次

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,1
if link.eof and link.bof then
response.Write("&nbsp;暂无记录 !")
end if
while not link.eof
p = link("useradmin")
m = link("userpassword")
d = 1
Set 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.movenext
wend
link.close
set link=nothing%>
</body>
</html>



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

------解决方案--------------------
你每次都 select top 1 id from,这步操作是否可以不做的?

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