function exctoacc(excpath,mdbpath)
Dim excConn,Coon
Dim excStrConn,strConn
Dim excrs,rs
Dim excSql
Set excconn=Server.CreateObject("ADODB.Connection")
Set excrs = Server.CreateObject("ADODB.Recordset")
excStrC&Server.MapPath(excpath)
excconn.Open excStrConn
excSql="select * from [Sheet1$]" '查询excel语句
excrs.Open excSql,excconn,2,2
set rs=server.createObject("ADODB.Recordset")
Set conn=Server.CreateObject("ADODB.Connection")
StrC&Server.MapPath(mdbpath)
conn.Open StrConn
del_str="delete * from Sheet1"
conn.execute del_str
sql="select * from Sheet1" '修改
rs.open sql,conn,1,3
do while Not excrs.EOF
rs.addnew
for i=0 to excrs.Fields.Count-1
rs(i+1)=excrs(i)
next
rs.update
excrs.MoveNext
Loop
rs.close
set rs=nothing
excrs.close
set excrs=nothing
excConn.close
set excConn=nothing
conn.close
set conn=nothing
exctoacc="<script>alert('数据导入成功!');javascript:window.location.href='index.htm'</script>"End function
调用方法: response.write exctoacc("cc.xls","db1.mdb")