代码是这样的帮我看一下
<%dim aa
aa=request.form("bbb")
'获取传递过来的值
Dim
StrConnect,cc
Dim
objConn
Dim
rs
Dim
Sql
cc=0
'Excel连接驱动
aaa="provider=Microsoft.Jet.OLEDB.4.0; Data Source="&aa&";Extended Properties=Excel 8.0"
set StrConnect=CreateObject("ADODB.Connection")
StrConnect.Open aaa
Set
objConn=CreateObject("ADODB.Connection")
objConn.Open
StrConnect
'注意
表名一定要以下边这种格试
"[表名$]"
书写
Set
rs = Server.CreateObject("ADODB.Recordset")
Sql="select
*
from
[Sheet1$]
"
rs.Open
Sql,StrConnect,2,2
IF
rs.Eof
And
Rs.Bof
Then
response.Write("<script>alert
('没有资料可以导入!');history.go(-1)</script>")
else
Do
While
Not
rs.EOF
'列出表内信息
response.write"excel数据为: <br>"
response.write ""&rs(0)&"-"&rs(1)&"-"&rs(2)&""
response.write"<br>"
set
rssql=server.CreateObject("adodb.recordset")
'插入SQL2000里
rssql.Open
"select
*
from
School",conn,1,3
rssql.AddNew
if
rs(0)<>""
then
rssql(1)=rs(0)
end
if
if
rs(1)<>""
then
rssql(2)=rs(1)
end
if
if
rs(2)<>""
then
rssql(3)=rs(2)
end
if
rssql.Update
cc=cc+1
Rs.MoveNext
Loop
end
if
response.Write
"<script
language=javascript>alert('资料导入成功!\n共有"&cc&"条数据导入');history.go(-1)</script>"
%>