日期:2014-05-16 浏览次数:20953 次
......前面省略
<%
on error resume next
if request("action") = "new" then
If Trim(Request("eFile")) = "" Then
response.write"<SCRIPT language=JavaScript>alert('您未选择EXCEL文件!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
ElseIf Right(Trim(Request("eFile")),3) <> "xls" Then
response.write"<SCRIPT language=JavaScript>alert('您选择的不是有效的EXCEL文件!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
Else
Dim connExcel, rsExcel,rsDB
set connExcel=CreateObject("ADODB.connection")
connExcel.Open "Driver={Microsoft Excel Driver (*.xls)};" & _
"DriverId=790;" & _
"Dbq=" & Trim(Request("eFile"))& ";" & _
"DefaultDir=D:\"
set rsExcel=createobject("ADODB.recordset")
rsExcel.Open "Select * From [Sheet1$]",connExcel, 2, 2
if rsExcel.eof then
response.write"<SCRIPT language=JavaScript>alert('您选择的EXCEL中无数据,或您未关闭EXCEL文件!');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
else
Set rsDB = Server.CreateObject("ADODB.Recordset")
conn.execute("delete ab_tbl.* from ab_tbl")
SqlDB="Select ab_tbl.* from ab_tbl"
'conndb.execute("alter table ab_tbl alter column ab_id counter(1,1)")
' Set RsDB7 = Server.CreateObject("ADODB.Recordset")
' SqlDB7="delete ab_tbl.* from ab_tbl"
' RsDB7.open sqlDB7,connDB,1,3
' rsdb7.close
' set rsdb7=nothing
do while not rsExcel.eof '利用循环读出数据
' response.write rs(0)&" "
' response.write rs(1)&" "
' response.write rs(2)&" "
' response.write rs(3)&" "
' response.write rs(4)&" "
' response.write "<br>"