回复 2楼 yms123
我用的是如下代码:
<%
Dim excConn,Coon
Dim excStrConn,strConn
Dim excrs,rs
Dim excSql
Set excconn=Server.CreateObject("ADODB.Connection")
Set excrs = Server.CreateObject("ADODB.Recordset")
excStrConn="Driver={Microsoft Excel Driver (*.xls)};DriverId=790; DBQ="&Server.MapPath("database/sbfhs.xls")
excconn.Open excStrConn
excSql="select * from [sbfhs$]" '查询excel语句
excrs.Open excSql,excconn,2,2
set rs=server.createObject("ADODB.Recordset")
Set conn=Server.CreateObject("ADODB.Connection")
StrConn="provider=microsoft.jet.oledb.4.0; data source="&Server.MapPath("database/yjglxt.mdb")
conn.Open StrConn
sql="select * from clfhs" '修改
rs.open sql,conn,1,3
do while Not excrs.EOF
rs.addnew
for i=0 to excrs.Fields.Count-1
rs(i)=excrs(i)
next
rs.update
excrs.MoveNext
Loop
rs.close
set rs1=nothing
excrs.close
set excrs=nothing
excConn.close
set excConn=nothing
conn.close
set conn=nothing
response.write" 数据导入成功!"
response.end
%>
请yms123版主帮我看看代码有没有问题。